/** * Verifies a users email * * @param $user_id * * @param $token * * @return bool */ public function VerifyUser($user_id, $token) { if ($this->user_actions->GetUser($user_id) != null) { if ($this->IsVerified($user_id)) { return false; } /** * Lets get our attempts */ $attempts = $this->GetVerifyAttempts($user_id); /** * No attempts have been made */ if ($attempts == null) { return false; } /** * If it is in this array, lets pull the single result it is found in */ if (in_array($attempts, $token)) { $row = $this->PickRow($attempts, $token); /** * If this token is valid, lets now check its date and see if it matches up */ if ($row['token_date'] < Time::HoursPast($row['token_date'], SettingsManager::GetSetting('syscrack_security_email_verification_time'))) { /** * Great, this token matches the user, its in date, and its valid! Hurray! */ $this->database->RemoveUserTokens($user_id); /** * Then lets return true! */ return true; } } } /** * The user has not verified! */ return false; }
/** * Gets the scope of which we search * * @return int */ public function GetHoursScope() { return Time::HoursAhead(SettingsManager::GetSetting('syscrack_security_bruteforce_scope')); }