From fa706c8e860d4057f401b3ca0dff04fb8aa47363 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 9 Jul 2014 21:10:56 -0700 Subject: finish implementing email verification. Currently it only applies if REGISTER_OPEN is in effect. --- mod/register.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'mod/register.php') diff --git a/mod/register.php b/mod/register.php index 990cce2ed..2a6e16a6d 100644 --- a/mod/register.php +++ b/mod/register.php @@ -52,14 +52,17 @@ function register_post(&$a) { $policy = get_config('system','register_policy'); + $email_verify = get_config('system','verify_email'); + + switch($policy) { case REGISTER_OPEN: - $flags = ACCOUNT_UNVERIFIED; + $flags = ACCOUNT_OK; break; case REGISTER_APPROVE: - $flags = ACCOUNT_UNVERIFIED | ACCOUNT_BLOCKED | ACCOUNT_PENDING; + $flags = ACCOUNT_BLOCKED | ACCOUNT_PENDING; break; default: @@ -68,10 +71,13 @@ function register_post(&$a) { notice( t('Permission denied.') . EOL ); return; } - $flags = ACCOUNT_UNVERIFIED | ACCOUNT_BLOCKED; + $flags = ACCOUNT_BLOCKED; break; } + if($email_verify) + $flags = $flags | ACCOUNT_UNVERIFIED; + if((! $_POST['password']) || ($_POST['password'] !== $_POST['password2'])) { notice( t('Passwords do not match.') . EOL); @@ -100,7 +106,12 @@ function register_post(&$a) { } if($policy == REGISTER_OPEN ) { - $res = send_verification_email($result['email'],$result['password']); + if($email_verify) { + $res = verify_email_address($result); + } + else { + $res = send_verification_email($result['email'],$result['password']); + } if($res) { info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ; } @@ -116,6 +127,10 @@ function register_post(&$a) { goaway(z_root()); } + if($email_verify) { + goaway(z_root()); + } + authenticate_success($result['account'],true,false,true); if(! strlen($next_page = get_config('system','workflow_register_next'))) -- cgit v1.2.3