Can use security answers to create password reset token

This commit is contained in:
Pierre
2018-05-26 07:28:36 +02:00
parent 3ecdfe257d
commit 5a928c9198
3 changed files with 69 additions and 0 deletions

View File

@ -291,6 +291,25 @@ class AccountComponent {
return CS::get()->db->updateDB(self::USER_TABLE, "ID = ?", $modif, array($userID));
}
/**
* Set new password reset token for an account
*
* @param int $userID Target user ID
* @param string $token The new token to apply
* @return bool TRUE for a success / FALSE else
*/
public function set_new_password_reset_token(int $userID, string $token) : bool {
//Prepare database update
$modifs = array(
"pasword_reset_token" => $token,
"password_reset_token_time_create" => time()
);
//Apply update
return cs()->db->updateDB(self::USER_TABLE, "ID = ?", $modifs, array($userID));
}
/**
* Crypt user password
*