aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Regate.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-04-10 10:53:27 +0000
committerMario <mario@mariovavti.com>2021-04-10 10:53:27 +0000
commitea721d380be15d06a9f0974dc98487523fcdfb58 (patch)
treed8e16e595f24302e74343119b155df683beca66d /Zotlabs/Module/Regate.php
parente193b6d870482da0d499e886f6add31bdc7c9d5a (diff)
downloadvolse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.tar.gz
volse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.tar.bz2
volse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.zip
register: move some html out of the code and provide a basic template
Diffstat (limited to 'Zotlabs/Module/Regate.php')
-rw-r--r--Zotlabs/Module/Regate.php55
1 files changed, 33 insertions, 22 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index 4c7c96284..16b669dfc 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -252,35 +252,46 @@ class Regate extends \Zotlabs\Web\Controller {
return $o;
}
- if ( argc() > 1 ) {
- $did2 = hex2bin( substr( argv(1), 0, -1) );
- $didx = substr( argv(1), -1 );
- $deny = argc() > 2 ? argv(2) : '';
- $deny = preg_match('/^[0-9a-f]{8,8}$/', $deny) ? hex2bin($deny) : false;
- }
-
- if ($_SESSION['zar']['msg']) {
- $o = replace_macros(get_markup_template('plain.tpl'), [
- '$title' => t('Your Registration'),
- '$now' => '',
- '$infos' => $_SESSION['zar']['msg'] . EOL,
+ 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' => [
+ t('Hold on, you can start verification in'),
+ t('Token validity')
+ ]
]);
- unset($_SESSION['zar']['msg']);
+ unset($_SESSION['zar']['delayed']);
return $o;
}
- $now = datetime_convert();
- $ip = $_SERVER['REMOTE_ADDR'];
+ if (argc() < 2)
+ return;
+
+ $did2 = hex2bin( substr( argv(1), 0, -1) );
+ $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 = '';
- $pin = $_SESSION['zar']['pin'] ?? '';
- unset($_SESSION['zar']['pin']);
-
-
- $title = t('Register Verification');
+ if(isset($_SESSION['zar']['pin'])) {
+ $pin = $_SESSION['zar']['pin'];
+ unset($_SESSION['zar']['pin']);
+ }
// do we have a valid dId2 ?
if (($didx == 'a' && substr( $did2 , -2) == substr( base_convert( md5( substr( $did2, 1, -2) ),16 ,10), -2)) || ($didx == 'e') || ($didx == 'i')) {
@@ -342,7 +353,7 @@ 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' => $title,
+ '$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,
@@ -361,7 +372,7 @@ class Regate extends \Zotlabs\Web\Controller {
}
$o = replace_macros(get_markup_template('plain.tpl'), [
- '$title' => $title,
+ '$title' => t('Register Verification'),
'$now' => $nowf,
'$countdown' => datetime_convert('UTC', 'UTC', $r['reg_startup'], 'c'),
'$infos' => t('Hold on, you can start verification in') . EOL,