aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-19 11:43:48 +0100
committerMario <mario@mariovavti.com>2021-03-19 11:43:48 +0100
commit06d47deef80d19230ee6c801c97c3e8913012671 (patch)
tree8acbba20ba38c45460ac6106b9e7e610e2a07a0b
parent85d000e7920ec5ab56bc33e2e4b2d86036fee830 (diff)
downloadvolse-hubzilla-06d47deef80d19230ee6c801c97c3e8913012671.tar.gz
volse-hubzilla-06d47deef80d19230ee6c801c97c3e8913012671.tar.bz2
volse-hubzilla-06d47deef80d19230ee6c801c97c3e8913012671.zip
air: improved UX by changing the registration workflow so that it is not required to go back to registration and post the DID. If no registration delay is configured proceed directly to verification. fixes #1540
-rw-r--r--Zotlabs/Module/Regate.php7
-rw-r--r--Zotlabs/Module/Register.php32
2 files changed, 24 insertions, 15 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index 7379a6662..077e5fd54 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -122,6 +122,7 @@ class Regate extends \Zotlabs\Web\Controller {
if ( ($flags & ACCOUNT_PENDING ) == ACCOUNT_PENDING ) {
$msg .= "\n".t('Last step will be by an instance admin to agree your account request');
+ $nextpage = 'regapr/' . bin2hex($did2);
q("COMMIT");
}
elseif ( ($flags ^ REGISTER_AGREED) == 0) {
@@ -235,6 +236,10 @@ class Regate extends \Zotlabs\Web\Controller {
$nowfmt = $isduty['nowfmt'];
$atform = $isduty['atform'];
+ $pin = $_SESSION['zar']['pin'] ?? '';
+ unset($_SESSION['zar']['pin']);
+
+
$title = t('Register Verification');
// do we have a valid dId2 ?
@@ -298,7 +303,7 @@ class Regate extends \Zotlabs\Web\Controller {
$o = replace_macros(get_markup_template('regate.tpl'), [
'$form_security_token' => get_form_security_token("regate"),
'$title' => $title,
- '$desc' => t('You were given a validation token. Please enter that token here to continue the register verification step and allow some delay for proccessing.'),
+ '$desc' => $pin ? t('Please enter your validation token') . '<code class="inline">' . $pin . '</code>' : t('You were given a validation token. Please enter that token here to verify your registration.'),
'$did2' => bin2hex($did2) . $didx,
'$now' => $nowfmt,
'$atform' => $atform,
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index e98a61a5e..c25475550 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -301,12 +301,12 @@ class Register extends Controller {
if($policy == REGISTER_OPEN || $policy == REGISTER_APPROVE ) {
$cfgdelay = get_config( 'system', 'register_delay' );
- $regdelay = calculate_adue( $cfgdelay );
- $regdelay = $regdelay ? datetime_convert(date_default_timezone_get(), 'UTC', $regdelay['due']) : $now;
+ $reg_delayed = calculate_adue( $cfgdelay );
+ $regdelay = (($reg_delayed) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_delayed['due']) : $now);
$cfgexpire = get_config('system','register_expire' );
- $regexpire = calculate_adue( $cfgexpire );
- $regexpire = $regexpire ? datetime_convert(date_default_timezone_get(), 'UTC', $regexpire['due']) : datetime_convert('UTC', 'UTC', 'now + 99 years');
+ $reg_expires = calculate_adue( $cfgexpire );
+ $regexpire = (($reg_expires) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_expires['due']) : datetime_convert('UTC', 'UTC', 'now + 99 years'));
// handle an email request that will be verified or an ivitation associated with an email address
if ( $email > '' && ($email_verify || $icdone) ) {
@@ -320,7 +320,7 @@ class Register extends Controller {
$reonar['from'] = get_config('system', 'from_email');
$reonar['to'] = $email;
$reonar['subject'] = sprintf( t('Registration confirmation for %s'), get_config('system','sitename'));
- $reonar['txtpersonal']= t('Valid from') . ' <span data-utc="' . $regdelay . '" class="register_date">' . $regdelay . '</span> ' . t('and expire') . ' <span data-utc="' . $regexpire . '" class="register_date">' . $regexpire . '</span>';
+ $reonar['txtpersonal']= t('Valid from') . ' ' . $regdelay . ' UTC' . t('and expire') . ' ' . $regexpire . ' UTC';
$reonar['txttemplate']= replace_macros(get_intltext_template('register_verify_member.tpl'),
[
'$sitename' => get_config('system','sitename'),
@@ -387,15 +387,19 @@ class Register extends Controller {
zar_log( 'ZAR0239A ' . t('New register request') . ' d' . $didnew . ', '
. $regdelay . ' - ' . $regexpire);
- // notice( 'ZAR0239I,' . t( 'Your digital id is' ) . EOL . 'd' . $didnew . EOL
- $_SESSION['zar']['msg'] = ( 'ZAR0239I,' . t( 'Your digital id is' ) . EOL . 'd' . $didnew . EOL
- . t('and your pin for is') . ' ' . $pass2 . EOL
- . t('Keep these infos and your entered password safe') . EOL
- . t('Valid from') . ' <span data-utc="' . datetime_convert('UTC', 'UTC', $regdelay, 'c') . '" class="register_date">' . datetime_convert('UTC', 'UTC', $regdelay, 'c') . '</span> ' . t('and expire') . ' <span data-utc="' . datetime_convert('UTC', 'UTC', $regexpire, 'c') . '" class="register_date">' . datetime_convert('UTC', 'UTC', $regexpire, 'c') . '</span>' . EOL );
-
- // acpin verify
- // goaway(z_root() . '/regate/' . bin2hex('d' . $didnew) . 'a' );
- goaway(z_root() . '/regate');
+
+ if($reg_delayed) {
+ // notice( 'ZAR0239I,' . t( 'Your digital id is' ) . EOL . 'd' . $didnew . EOL
+ $_SESSION['zar']['msg'] = ( t('Your validation token is') . ' ' . $pass2 . EOL
+ . t('Please remember your token and reload this page between') . EOL
+ . '<code class="inline-code"><span data-utc="' . datetime_convert('UTC', 'UTC', $regdelay, 'c') . '" class="register_date">' . datetime_convert('UTC', 'UTC', $regdelay, 'c') . '</span></code> ' . t('and') . ' <code class="inline-code"><span data-utc="' . datetime_convert('UTC', 'UTC', $regexpire, 'c') . '" class="register_date">' . datetime_convert('UTC', 'UTC', $regexpire, 'c') . '</span></code>' . EOL
+ . t('to complete registration.')
+ );
+ }
+ else {
+ $_SESSION['zar']['pin'] = $pass2;
+ }
+ goaway(z_root() . '/regate/' . bin2hex('d' . $didnew) . 'a' );
}
else {
$msg = 'ZAR0239D,' . t('Error creating dId A');