Index: branches/5.2.x/core/units/helpers/user_helper.php =================================================================== diff -u -N -r14437 -r14472 --- branches/5.2.x/core/units/helpers/user_helper.php (.../user_helper.php) (revision 14437) +++ branches/5.2.x/core/units/helpers/user_helper.php (.../user_helper.php) (revision 14472) @@ -1,6 +1,6 @@ 'config:Users_AllowReset', + 'activation' => 'config:UserEmailActivationTimeout', + 'custom' => '', + ); + + if ( !$user_code ) { + return 'code_is_not_valid'; + } + + $sql = 'SELECT PwRequestTime, PortalUserId + FROM ' . TABLE_PREFIX . 'PortalUser + WHERE PwResetConfirm = ' . $this->Conn->qstr( trim($user_code) ); + $user_info = $this->Conn->GetRow($sql); + + if ( $user_info === false ) { + return 'code_is_not_valid'; + } + + $expiration_timeout = isset($expiration_timeout) ? $expiration_timeout : $expiration_timeouts[$code_type]; + + if ( preg_match('/^config:(.*)$/', $expiration_timeout, $regs) ) { + $expiration_timeout = $this->Application->ConfigValue( $regs[1] ); + } + + if ( $expiration_timeout && $user_info['PwRequestTime'] < strtotime('-' . $expiration_timeout . ' minutes') ) { + return 'code_expired'; + } + + return $user_info['PortalUserId']; + } }