diff options
Diffstat (limited to 'app/php/facades/UserFacade.php')
-rw-r--r-- | app/php/facades/UserFacade.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/php/facades/UserFacade.php b/app/php/facades/UserFacade.php index 69d634a..3fbd62d 100644 --- a/app/php/facades/UserFacade.php +++ b/app/php/facades/UserFacade.php @@ -7,15 +7,15 @@ Prado::using('Application.dto.TimezoneDTO'); class UserFacade extends Facade { - public function findByLogin($login) { + public function findByLogin(string $login) { return User::finder()->findByLogin($login); } - public function checkForUsername($login) { + public function checkForUsername(string $login) { return !User::finder()->count('login = ?', $login); } - public function registerUser($login, $password, $admin) { + public function registerUser(string $login, string $password, bool $admin) { $transaction = $this->beginTransaction(); try { $newUser = new User(); @@ -32,27 +32,27 @@ class UserFacade extends Facade { } } - public function changePassword(DbUser $user, $pass) { + public function changePassword(DbUser $user, string $pass) { if (!$user->IsGuest) { $user->DbRecord->Password = $this->generatePassword($pass); $user->DbRecord->save(); } } - public function verifyUserPassword($password, DbUser $user) { + public function verifyUserPassword(string $password, DbUser $user) { $dbPassword = $user->IsGuest ? '' : $user->DbRecord->Password; return $this->verifyPassword($password, $dbPassword); } - public function generatePassword($password) { + public function generatePassword(string $password) { return password_hash($password, PASSWORD_DEFAULT); } - public function verifyPassword($password, $dbPassword) { + public function verifyPassword(string $password, string $dbPassword) { return password_verify($password, $dbPassword); } - public function setTimezonePreference(DbUser $user, $timezone) { + public function setTimezonePreference(DbUser $user, string $timezone) { if ($user->IsGuest) { throw new TInvalidDataException( 'Timezone preference change impossible for guest user' |