From 8360aee13cbcb6cddc5924298d4b23d9d2758ba6 Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 28 Aug 2021 18:51:12 -0700 Subject: [PATCH] code comments --- Zotlabs/Module/Register.php | 9 +++++++-- boot.php | 28 +++++++++++++++++++--------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 96bbcfe8b..e03510ccd 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -118,8 +118,13 @@ class Register extends Controller { if ($_REQUEST['permissions_role']) { set_aconfig($result['account']['account_id'],'register','permissions_role',$_REQUEST['permissions_role']); } - - + + // At this point the account has been created without error. Purge any error messages from prior failed registration + // attempts which haven't yet been delivered to the browser and start fresh. If you're willing to figure out why they + // weren't delivered to the browser please adopt zap issue 34. + + $_SESSION['sysmsg'] = []; + $using_invites = intval(get_config('system','invitation_only')); $num_invites = intval(get_config('system','number_invites')); $invite_code = ((x($_POST,'invite_code')) ? notags(trim($_POST['invite_code'])) : ''); diff --git a/boot.php b/boot.php index 9d48d9de0..078d51c54 100755 --- a/boot.php +++ b/boot.php @@ -1845,19 +1845,24 @@ function can_view_public_stream() { * @param string $s Text to display */ function notice($s) { - if(! session_id()) - return; - if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = []; + if (! session_id()) { + return; + } + + if (! x($_SESSION, 'sysmsg')) { + $_SESSION['sysmsg'] = []; + } // ignore duplicated error messages which haven't yet been displayed // - typically seen as multiple 'permission denied' messages // as a result of auto-reloading a protected page with &JS=1 - if(in_array($s, $_SESSION['sysmsg'])) + if (in_array($s, $_SESSION['sysmsg'])) { return; + } - if(App::$interactive) { + if (App::$interactive) { $_SESSION['sysmsg'][] = $s; } } @@ -1873,16 +1878,21 @@ function notice($s) { * @param string $s Text to display */ function info($s) { - if(! session_id()) + if (! session_id()) { return; - if(! x($_SESSION, 'sysmsg_info')) + } + + if (! x($_SESSION, 'sysmsg_info')) { $_SESSION['sysmsg_info'] = []; + } - if(in_array($s, $_SESSION['sysmsg_info'])) + if (in_array($s, $_SESSION['sysmsg_info'])) { return; + } - if(App::$interactive) + if (App::$interactive) { $_SESSION['sysmsg_info'][] = $s; + } } /**