Skip to content

Commit

Permalink
Fix captcha validation
Browse files Browse the repository at this point in the history
Following 7bb78e4, it was no longer
possible to validate the captcha, because the PHP session is destroyed
as part of the logout performed in signup.php.

We now retrieve the captcha key from the session before logging out.

Fixes #17993
  • Loading branch information
dregad committed Jan 17, 2015
1 parent afa6c90 commit 1eab7ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/session_api.php
Expand Up @@ -171,6 +171,7 @@ function destroy() {
}

unset( $_SESSION[ $this->key ] );
session_write_close();
}
}

Expand Down
5 changes: 3 additions & 2 deletions signup.php
Expand Up @@ -37,6 +37,9 @@
$f_email = email_append_domain( trim( $f_email ) );
$f_captcha = utf8_strtolower( trim( $f_captcha ) );

# Retrieve captcha key now, as session might get cleared by logout
$t_form_key = session_get_int( CAPTCHA_KEY, null );

# force logout on the current user if already authenticated
if( auth_is_user_authenticated() ) {
auth_logout();
Expand All @@ -50,8 +53,6 @@

if( ON == config_get( 'signup_use_captcha' ) && get_gd_version() > 0 &&
helper_call_custom_function( 'auth_can_change_password', array() ) ) {
$t_form_key = session_get( CAPTCHA_KEY );

# captcha image requires GD library and related option to ON
$t_key = utf8_strtolower( utf8_substr( md5( config_get( 'password_confirm_hash_magic_string' ) . $t_form_key ), 1, 5) );

Expand Down

0 comments on commit 1eab7ac

Please sign in to comment.