aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-04-10 20:44:04 +0000
committerMario <mario@mariovavti.com>2021-04-10 20:44:04 +0000
commitf0e5ce7fd1dae13cc257a8a860fccbc294530776 (patch)
tree050bac84731085a4c8cbc70ae3c9435448dbf11e
parentea721d380be15d06a9f0974dc98487523fcdfb58 (diff)
downloadvolse-hubzilla-f0e5ce7fd1dae13cc257a8a860fccbc294530776.tar.gz
volse-hubzilla-f0e5ce7fd1dae13cc257a8a860fccbc294530776.tar.bz2
volse-hubzilla-f0e5ce7fd1dae13cc257a8a860fccbc294530776.zip
register: more work on ui/ux
-rw-r--r--Zotlabs/Module/Regate.php82
-rw-r--r--Zotlabs/Module/Register.php4
-rw-r--r--include/account.php14
-rw-r--r--view/tpl/regate.tpl45
-rw-r--r--view/tpl/regate_pre.tpl58
-rw-r--r--view/tpl/register.tpl8
6 files changed, 119 insertions, 92 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index 16b669dfc..bc2e578b6 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -252,20 +252,21 @@ class Regate extends \Zotlabs\Web\Controller {
return $o;
}
+ $isduty = zar_register_dutystate();
+ $nowfmt = $isduty['nowfmt'];
+ $atform = $isduty['atform'];
+
if ($_SESSION['zar']['delayed']) {
$o = replace_macros(get_markup_template('regate_pre.tpl'), [
- '$title' => t('Register Verification'),
- '$id' => $_SESSION['zar']['id'],
- '$pin' => $_SESSION['zar']['pin'],
- '$regdelay' => $_SESSION['zar']['regdelay'],
- '$regexpire' => $_SESSION['zar']['regexpire'],
- '$desc' => [
- t('Please remember your validation token and ID'),
- t('Your ID'),
- t('Your token')
- ],
- '$delay_desc' => [
+ '$title' => t('Registration validation'),
+ '$now' => $nowfmt,
+ '$id' => $_SESSION['zar']['id'],
+ '$pin' => $_SESSION['zar']['pin'],
+ '$regdelay' => $_SESSION['zar']['regdelay'],
+ '$regexpire' => $_SESSION['zar']['regexpire'],
+ '$strings' => [
t('Hold on, you can start verification in'),
+ t('Please remember your validation token for ID'),
t('Token validity')
]
]);
@@ -280,12 +281,9 @@ class Regate extends \Zotlabs\Web\Controller {
$didx = substr( argv(1), -1 );
$deny = argc() > 2 ? argv(2) : '';
$deny = preg_match('/^[0-9a-f]{8,8}$/', $deny) ? hex2bin($deny) : false;
-
$now = datetime_convert();
$ip = $_SERVER['REMOTE_ADDR'];
- $isduty = zar_register_dutystate();
- $nowfmt = $isduty['nowfmt'];
- $atform = $isduty['atform'];
+
$pin = '';
if(isset($_SESSION['zar']['pin'])) {
@@ -309,13 +307,14 @@ class Regate extends \Zotlabs\Web\Controller {
// is still only instance admins intervention required?
if ( $r['reg_flags'] == ACCOUNT_PENDING ) {
- $o = replace_macros(get_markup_template('plain.tpl'), [
- '$title' => t('Register Verification Status'),
- '$now' => $nowfmt,
- '$infos' => t('Verification successful!') . EOL
- . t('After your account has been approved by our administrator you will be able to login with your ID') . EOL
- . $did2 . EOL
- . t('and your provided password.')
+ $o = replace_macros(get_markup_template('regate_post.tpl'), [
+ '$title' => t('Registration status'),
+ '$pin' => $did2,
+ '$infos' => [
+ t('Verification successful!'),
+ t('Your login ID'),
+ t('After your account has been approved by our admin you will be able to login with your ID and your provided password.')
+ ]
]);
}
else {
@@ -329,7 +328,7 @@ class Regate extends \Zotlabs\Web\Controller {
$msg = 'ZAR1133A' . ' ' . t('Sorry for any inconvience. Thank you for your response.');
$o = replace_macros(get_markup_template('plain.tpl'), [
'$title' => t('Registration request denied'),
- '$now' => $nowf,
+ '$now' => $nowfmt,
'$infos' => $msg . EOL,
]);
@@ -353,14 +352,18 @@ class Regate extends \Zotlabs\Web\Controller {
if ( $r['reg_startup'] <= $now && $r['reg_expires'] >= $now) {
$o = replace_macros(get_markup_template('regate.tpl'), [
'$form_security_token' => get_form_security_token("regate"),
- '$title' => t('Register Verification'),
- '$desc' => $pin ? t('Please enter your validation token') . ' <code class="inline-code">' . $pin . '</code>' : t('Please enter your validation token'),
- '$did2' => bin2hex($did2) . $didx,
- '$now' => $nowfmt,
- '$atform' => $atform,
- '$resend' => $resend,
- '$submit' => t('Submit'),
- '$acpin' => [ 'acpin', t('Validation token'),'','' ]
+ '$title' => t('Registration validation'),
+ '$desc' => t('Please enter your validation token for ID'),
+ '$id' => $did2,
+ // we might consider to not provide $pin if a registration delay is configured
+ // and the pin turns out to be readable by bots
+ '$pin' => $pin,
+ '$did2' => bin2hex($did2) . $didx,
+ '$now' => $nowfmt,
+ '$atform' => $atform,
+ '$resend' => $resend,
+ '$submit' => t('Submit'),
+ '$acpin' => [ 'acpin', t('Validation token'),'','' ]
]);
}
else {
@@ -371,12 +374,15 @@ class Regate extends \Zotlabs\Web\Controller {
);
}
- $o = replace_macros(get_markup_template('plain.tpl'), [
- '$title' => t('Register Verification'),
- '$now' => $nowf,
+ $o = replace_macros(get_markup_template('regate_pre.tpl'), [
+ '$title' => t('Registration validation'),
+ '$now' => $nowfmt,
+ '$id' => $did2,
'$countdown' => datetime_convert('UTC', 'UTC', $r['reg_startup'], 'c'),
- '$infos' => t('Hold on, you can start verification in') . EOL,
- ]);
+ '$strings' => [
+ t('Hold on, you can start verification in'),
+ t('You will require the validation token for ID')
+ ] ]);
}
}
}
@@ -386,7 +392,7 @@ class Regate extends \Zotlabs\Web\Controller {
zar_log('ZAR1132E ' . $msg . ':' . $did2 . ',' . $didx);
$o = replace_macros(get_markup_template('plain.tpl'), [
'$title' => $title,
- '$now' => $nowf,
+ '$now' => $nowfmt,
'$infos' => $msg . EOL,
]);
}
@@ -398,7 +404,7 @@ class Regate extends \Zotlabs\Web\Controller {
zar_log($msg);
$o = replace_macros(get_markup_template('plain.tpl'), [
'$title' => $title,
- '$now' => $nowf,
+ '$now' => $nowfmt,
'$infos' => ($msg) . EOL,
]);
}
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index e96037760..2c73f3d6d 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -80,10 +80,6 @@ class Register extends Controller {
if($auto_create) {
$name = escape_tags(trim($arr['name']));
- if(!$name) {
- notice(t('Name is required.'));
- return;
- }
$name_error = validate_channelname($name);
if($name_error) {
diff --git a/include/account.php b/include/account.php
index f7e2c7e32..939a4344e 100644
--- a/include/account.php
+++ b/include/account.php
@@ -1241,20 +1241,20 @@ function zar_register_dutystate( $now=NULL, $day=NULL ) {
$atform = $isduty ? '' : 'disabled';
$utc_now = datetime_convert(date_default_timezone_get(), 'UTC', $now, 'c');
- $nowfmt = t('Registration is currently')
- . ' (<span data-utc="' . $utc_now . '" class="register_date">' . $utc_now . '</span>) '
- . $dutyis . '.<br>';
-
+ $nowfmt = '';
if (!$isduty) {
+ $nowfmt = t('Registration is currently');
+ $nowfmt .= ' (<span data-utc="' . $utc_now . '" class="register_date">' . $utc_now . '</span>) ';
+ $nowfmt .= $dutyis . ',<br>';
+
$pernext = zarIsDuty($day, $now, 'nextOpen');
$week_days = ['','monday','tuesday','wednesday','thursday','friday','saturday','sunday'];
$utc_next_open = datetime_convert(date_default_timezone_get(), 'UTC', $week_days[$pernext[0]] . ' ' . $pernext[1], 'c');
if (is_array($pernext)) {
- $nowfmt .= t('Next opens') . ' '
- . '<span data-utc="' . $utc_next_open . '" class="register_date">' . $utc_next_open . '</span>.';
-
+ $nowfmt .= t('please come back');
+ $nowfmt .= ' <span data-utc="' . $utc_next_open . '" class="register_date">' . $utc_next_open . '</span>.';
}
}
return array( 'isduty' => $isduty, 'nowfmt' => $nowfmt, 'atform' => $atform);
diff --git a/view/tpl/regate.tpl b/view/tpl/regate.tpl
index 6eaac1478..b9239ee46 100644
--- a/view/tpl/regate.tpl
+++ b/view/tpl/regate.tpl
@@ -1,25 +1,38 @@
-<h2>{{$title}}</h2>
+<div class="generic-content-wrapper">
+ <div class="section-title-wrapper">
+ <h2>{{$title}}</h2>
+ </div>
+ <div class="section-content-wrapper">
+ {{if $now}}
+ <div class="section-content-danger-wrapper">
+ <div class="h3">{{$now}}</div>
+ </div>
+ {{else}}
+ <div class="section-content-info-wrapper">
+ {{$desc}} {{$id}}
+ <div class="h3">{{$pin}}</div>
+ </div>
-<div class="descriptive-paragraph" style="font-size: 1.2em;"><p>{{$desc}}</p></div>
+ <form action="regate/{{$did2}}" method="post">
+ <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+ {{include file="field_input.tpl" field=[$acpin.0,$acpin.1,"","","",$atform]}}
-<form action="regate/{{$did2}}" method="post">
-<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-{{include file="field_input.tpl" field=[$acpin.0,$acpin.1,"","","",$atform]}}
+ <div class="pull-right submit-wrapper">
+ <button type="submit" name="submit" class="btn btn-primary" {{$atform}}>{{$submit}}</button>
+ </div>
-<div class="pull-right submit-wrapper">
- <button type="submit" name="submit" class="btn btn-primary"{{$atform}}>{{$submit}}</button>
-</div>
+ {{if $resend}}
+ <div class="resend-email" >
+ <button type="submit" name="resend" class="btn btn-warning" {{$atform}}>{{$resend}}</button>
+ </div>
+ {{/if}}
-{{if $resend > ''}}
-<div class="resend-email" >
- <button type="submit" name="resend" class="btn btn-warning"{{$atform}}>{{$resend}}</button>
+ </form>
+ {{/if}}
+ <div class="clearfix"></div>
+ </div>
</div>
-{{/if}}
-
-</form>
-<div class="clear"></div>
<script>
- var week_days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];
$('.register_date').each( function () {
var date = new Date($(this).data('utc'));
$(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'}));
diff --git a/view/tpl/regate_pre.tpl b/view/tpl/regate_pre.tpl
index adc63b181..7596f6846 100644
--- a/view/tpl/regate_pre.tpl
+++ b/view/tpl/regate_pre.tpl
@@ -1,41 +1,49 @@
-<h2>{{$title}}</h2>
-
-{{$delay_desc.0}}
-<div id="countdown" class="h3"></div>
-
-{{$desc.0}}<br>
-<br>
-{{$desc.1}}<br>
-{{$id}}<br>
-<br>
-{{$desc.2}}<br>
-{{$pin}}<br>
-<br>
-<div class="">
- {{$delay_desc.1}}<br>
- <span id="register_start" data-utc="{{$regdelay}}" class="register_date">
- {{$regdelay}}
- </span>
- &nbsp;&dash;&nbsp;
- <span data-utc="{{$regexpire}}" class="register_date">
- {{$regexpire}}
- </span>
+<div class="generic-content-wrapper">
+ <div class="section-title-wrapper">
+ <h2>{{$title}}</h2>
+ </div>
+ <div class="section-content-wrapper">
+ {{if $now}}
+ <div class="section-content-danger-wrapper">
+ <div class="h3">{{$now}}</div>
+ </div>
+ {{else}}
+ <div class="section-content-warning-wrapper">
+ {{$strings.0}}
+ <div id="countdown" class="h3"></div>
+ </div>
+ <div class="section-content-info-wrapper">
+ {{$strings.1}} {{$id}}
+ <div class="h3">{{$pin}}</div>
+ </div>
+ <div class="d-none">
+ {{$strings.2}}<br>
+ <span id="register_start" data-utc="{{$regdelay}}" class="register_date">
+ {{$regdelay}}
+ </span>
+ &nbsp;&dash;&nbsp;
+ <span data-utc="{{$regexpire}}" class="register_date">
+ {{$regexpire}}
+ </span>
+ </div>
+ {{/if}}
+ </div>
</div>
+
<script>
$('.register_date').each( function () {
var date = new Date($(this).data('utc'));
- $(this).html(date.toLocaleString());
+ $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'}));
});
-
var date = '{{$countdown}}';
-
date = date !== '' ? date : $('#register_start').data('utc');
if(date) {
doCountDown(date, 'countdown');
var x = setInterval(doCountDown, 1000, date, 'countdown');
}
+
function doCountDown(date, id) {
var countDownDate = new Date(date).getTime();
var now = new Date().getTime();
diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl
index 761e48773..03cead08f 100644
--- a/view/tpl/register.tpl
+++ b/view/tpl/register.tpl
@@ -5,9 +5,13 @@
<div class="section-content-wrapper">
<form action="register" method="post" id="register-form">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
- {{if $reg_is || $other_sites || $now || $msg}}
- <div class="section-content-warning-wrapper">
+ {{if $now}}
+ <div class="section-content-danger-wrapper">
<div class="h3">{{$now}}</div>
+ </div>
+ {{/if}}
+ {{if $reg_is || $other_sites || $msg}}
+ <div class="section-content-warning-wrapper">
<div id="register-desc" class="descriptive-paragraph">{{$msg}}</div>
<div id="register-desc" class="descriptive-paragraph">{{$reg_is}}</div>
<div id="register-sites" class="descriptive-paragraph">{{$other_sites}}</div>