Can check the validity of a password reset token

This commit is contained in:
Pierre
2018-05-26 14:52:05 +02:00
parent d3570af12f
commit 9711e6b087
2 changed files with 47 additions and 0 deletions

View File

@ -175,6 +175,27 @@ class accountController {
);
}
/**
* Check the validity of a reset account token
*
* @url POST /account/check_password_reset_token
*/
public function checkResetAccountToken(){
//Get the token
$token = postString("token", 10);
//Validate the tokens
$userID = components()->account->getUserIDfromResetToken($token);
//Check if the user ID is valid
if($userID < 1)
Rest_fatal_error(401, "Invalid token!");
//The token is valid
return array("success" => "The token is valid.");
}
/**
* Create an account
*