summaryrefslogtreecommitdiff
path: root/app/php/user
diff options
context:
space:
mode:
Diffstat (limited to 'app/php/user')
-rw-r--r--app/php/user/DbUser.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/php/user/DbUser.php b/app/php/user/DbUser.php
index c8459fa..bb6f78e 100644
--- a/app/php/user/DbUser.php
+++ b/app/php/user/DbUser.php
@@ -37,7 +37,7 @@ class DbUser extends TDbUser {
public function validateUser($login, $password) {
$user = User::finder()->findByLogin($login);
$dbPassword = $user ? $user->Password : '';
- if (password_verify($password, $dbPassword) && $user) {
+ if (self::verifyPassword($password, $dbPassword) && $user) {
$user->LastLogin = date('Y-m-d H:i:s');
$user->save();
return TRUE;
@@ -62,6 +62,14 @@ class DbUser extends TDbUser {
}
}
+ public static function generatePassword($password) {
+ return password_hash($password, PASSWORD_DEFAULT);
+ }
+
+ public static function verifyPassword($password, $dbPassword) {
+ return password_verify($password, $dbPassword);
+ }
+
}
?>