From ad2aa84e4a81e194ebb54ce35edc8208753eb247 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 21 Feb 2017 09:19:09 +0100 Subject: [PATCH] Move method 'validatePassword' from class 'Auth' to 'UserManager' --- src/Auth.php | 21 --------------------- src/UserManager.php | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index 0c0b867..8f9915c 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -271,27 +271,6 @@ final class Auth extends UserManager { $this->authenticateUserInternal($password, null, $username, $rememberDuration); } - /** - * Validates a password - * - * @param string $password the password to validate - * @return string the password if it's valid - * @throws InvalidPasswordException if the password was invalid - */ - private static function validatePassword($password) { - if (empty($password)) { - throw new InvalidPasswordException(); - } - - $password = trim($password); - - if (strlen($password) < 1) { - throw new InvalidPasswordException(); - } - - return $password; - } - /** * Creates a new directive keeping the user logged in ("remember me") * diff --git a/src/UserManager.php b/src/UserManager.php index 60855cf..64383db 100644 --- a/src/UserManager.php +++ b/src/UserManager.php @@ -86,6 +86,27 @@ abstract class UserManager { return $email; } + /** + * Validates a password + * + * @param string $password the password to validate + * @return string the password if it's valid + * @throws InvalidPasswordException if the password was invalid + */ + protected static function validatePassword($password) { + if (empty($password)) { + throw new InvalidPasswordException(); + } + + $password = trim($password); + + if (strlen($password) < 1) { + throw new InvalidPasswordException(); + } + + return $password; + } + /** * Throttles the specified action for the user to protect against too many requests *