Commit 49c565e8 authored by Olle Haerstedt's avatar Olle Haerstedt

Dev: Add missing method setPassword() to User model (hash correct?)

parent a1e155cd
......@@ -292,4 +292,19 @@ class User extends LSActiveRecord
'permissions' => array(self::HAS_MANY, 'Permission', 'uid')
);
}
/**
* Set user password with hash
*
* @param string $sPassword The clear text password
* @return \User
*/
public function setPassword($sPassword, $save = false)
{
$this->password = password_hash($sPassword, PASSWORD_DEFAULT);
if ($save) {
$this->save();
}
return $this; // Return current object
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment