diff options
Diffstat (limited to 'classes/auth')
-rw-r--r-- | classes/auth/base.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/classes/auth/base.php b/classes/auth/base.php index f18cc2d2d..82ea06e1b 100644 --- a/classes/auth/base.php +++ b/classes/auth/base.php @@ -23,13 +23,14 @@ abstract class Auth_Base extends Plugin implements IAuthModule { if (!$password) $password = make_password(); - $salt = substr(bin2hex(get_random_bytes(125)), 0, 250); - $pwd_hash = encrypt_password($password, $salt, true); - - $sth = $this->pdo->prepare("INSERT INTO ttrss_users - (login,access_level,last_login,created,pwd_hash,salt) - VALUES (LOWER(?), 0, null, NOW(), ?,?)"); - $sth->execute([$login, $pwd_hash, $salt]); + $user = ORM::for_table('ttrss_users')->create(); + + $user->salt = UserHelper::get_salt(); + $user->login = mb_strtolower($login); + $user->pwd_hash = UserHelper::hash_password($password, $user->salt); + $user->access_level = 0; + $user->created = Db::NOW(); + $user->save(); return UserHelper::find_user_by_login($login); |