From 1fd5f5c893d224a523ecf279ec65c1cf933b2065 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 6 May 2021 19:06:53 +0000 Subject: register: redirect unverified registration emails to the verification form --- include/account.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/account.php b/include/account.php index 399756ed1..86132b411 100644 --- a/include/account.php +++ b/include/account.php @@ -34,23 +34,29 @@ function check_account_email($email) { if(! strlen($email)) return $result; - if(! validate_email($email)) - $result['message'] = t('The provided email address is not valid') . EOL; - elseif(! allowed_email($email)) + if(! validate_email($email)) { + $result['message'] = t('The provided email address is not valid'); + } + elseif(! allowed_email($email)) { $result['message'] = t('The provided email domain is not among those allowed on this site'); + } else { - $r = q("select account_email from account where account_email = '%s' limit 1", + $account = q("select account_email from account where account_email = '%s' limit 1", dbesc($email) ); - if (!$r) { - $r = q("select reg_did2 from register where reg_did2 = '%s' limit 1", - dbesc($email) - ); - } - if($r) { + if ($account) { $result['message'] = t('The provided email address is already registered at this site'); } + + $register = q("select reg_did2 from register where reg_vital = 1 and reg_did2 = '%s' limit 1", + dbesc($email) + ); + if ($register) { + $result['message'] = t('There is a pending registration for this address - click "Register" to continue verification'); + $result['email_unverified'] = true; + } } + if($result['message']) $result['error'] = true; -- cgit v1.2.3