diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/register.php | 23 |
1 files changed, 19 insertions, 4 deletions
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'))) |