diff options
author | Malf Furious <m@lfurio.us> | 2016-03-10 18:36:46 -0500 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-03-27 20:16:32 -0400 |
commit | 798cd5d80385705503c81be269c008e163fcbdba (patch) | |
tree | abefb79062bc17c2b3fd906ddf2413ef1514b96a /app/class/user.class.php | |
parent | ae2704f45ead57d437627efe7e4d44a564d923c4 (diff) | |
download | scrott-798cd5d80385705503c81be269c008e163fcbdba.tar.gz scrott-798cd5d80385705503c81be269c008e163fcbdba.zip |
Add function User::setPassword()
This user function will update the salt and key for a user object to change its password.
Diffstat (limited to 'app/class/user.class.php')
-rw-r--r-- | app/class/user.class.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/class/user.class.php b/app/class/user.class.php index 4f1bbfe..75b769a 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -99,8 +99,7 @@ class User extends Object $this->perms = 0; $this->name = $username; $this->type = "user"; - $this->salt = $this->getBlob(); - $this->key = $this->getKey($password, $this->salt); + $this->setPassword($password); $this->emailConf = 0; $this->emailConfKey = $this->getBlob(); @@ -122,6 +121,15 @@ class User extends Object } /* + * Overwrite the salt and key for this user, given a new plaintext password + */ + function setPassword($password) + { + $this->salt = $this->getBlob(); + $this->key = $this->getKey($password, $this->salt); + } + + /* * If a user has an alias set, display it instead of their username */ function getDisplayName() |