From 0c302ab8a01e32c9ff9000817ba74d40a4a7c203 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 8 Jun 2016 19:50:52 +0200 Subject: [PATCH] #3 docu token --- token/qq/SYS_SECURITY_CHANGE_EMAIL.php | 17 +++++++- token/qq/SYS_SECURITY_CONFIRM_EMAIL.php | 17 +++++++- token/qq/SYS_SECURITY_RESET_PASSWORD.php | 17 +++++++- token/qq/SYS_TOKEN_CONFIRM.php | 14 +++++++ token/qq/SYS_TOKEN_GET.php | 14 +++++++ token/qq/SYS_TOKEN_INSERT.php | 14 +++++++ token/token.php | 50 +++++++++++++++++++++++- token/token_change_email.php | 35 ++++++++++++++++- token/token_confirm_email.php | 35 ++++++++++++++++- token/token_handler.php | 31 +++++++++++++++ token/token_reset_password.php | 35 ++++++++++++++++- 11 files changed, 268 insertions(+), 11 deletions(-) diff --git a/token/qq/SYS_SECURITY_CHANGE_EMAIL.php b/token/qq/SYS_SECURITY_CHANGE_EMAIL.php index 8532fa2..fcd7a52 100644 --- a/token/qq/SYS_SECURITY_CHANGE_EMAIL.php +++ b/token/qq/SYS_SECURITY_CHANGE_EMAIL.php @@ -1,9 +1,22 @@ id : null)); return $token; } + + /** + * Confirm a token + * + * @param string $token Token string + * @return bool Returns true or false or throws an error depending on success. + */ public static function confirm($token){ $res = self::get($token); if(!$res){ @@ -37,9 +77,15 @@ class token{ throw new \SYSTEM\LOG\ERROR('Token_handler class not known to Token class. Please register it first.');} if(!\call_user_func_array(array($res['class'], 'confirm'),array($res))){ throw new \SYSTEM\LOG\ERROR('Token_handler rejected Token.');} - return \SYSTEM\SQL\SYS_TOKEN_CONFIRM::QI(array( \SYSTEM\SECURITY\security::isLoggedIn() ? \SYSTEM\SECURITY\security::getUser()->id : null, - $token)); + return \SYSTEM\SQL\SYS_TOKEN_CONFIRM::QI(array( \SYSTEM\SECURITY\security::isLoggedIn() ? \SYSTEM\SECURITY\security::getUser()->id : null, $token)); } + + /** + * Get a existing token from db + * + * @param string $token Token string + * @return array Returns database entry for the given Token if it exists. + */ public static function get($token){ return \SYSTEM\SQL\SYS_TOKEN_GET::Q1(array($token));} } \ No newline at end of file diff --git a/token/token_change_email.php b/token/token_change_email.php index b51d70b..0fab731 100644 --- a/token/token_change_email.php +++ b/token/token_change_email.php @@ -1,11 +1,44 @@