diff options
author | Simon Rettberg | 2021-05-05 10:53:00 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-05-11 14:50:11 +0200 |
commit | 34cd38967a05141b9c2236510c0e4f3fcec452da (patch) | |
tree | cf3c8588bc4b12c5b5826061c8e8d1c9cec443a8 /inc/user.inc.php | |
parent | [main+Session] Move session from /tmp/ to session table (diff) | |
download | slx-admin-34cd38967a05141b9c2236510c0e4f3fcec452da.tar.gz slx-admin-34cd38967a05141b9c2236510c0e4f3fcec452da.tar.xz slx-admin-34cd38967a05141b9c2236510c0e4f3fcec452da.zip |
[session] Add option to bind session to IP address
Diffstat (limited to 'inc/user.inc.php')
-rw-r--r-- | inc/user.inc.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/inc/user.inc.php b/inc/user.inc.php index 46cc6012..d587c462 100644 --- a/inc/user.inc.php +++ b/inc/user.inc.php @@ -142,14 +142,14 @@ class User return Database::exec('UPDATE user SET passwd = :passwd WHERE userid = :userid LIMIT 1', compact('userid', 'passwd')) > 0; } - public static function login($user, $pass) + public static function login(string $user, string $pass, bool $fixedIp) { $ret = Database::queryFirst('SELECT userid, passwd FROM user WHERE login = :user LIMIT 1', array(':user' => $user)); if ($ret === false) return false; if (!Crypto::verify($pass, $ret['passwd'])) return false; - Session::create($ret['passwd'], $ret['userid'], false); + Session::create($ret['passwd'], $ret['userid'], $fixedIp); Session::set('token', md5($ret['passwd'] . ',' . rand() . ',' . time() . ',' |