From 225a618713f319cf31f87764d0784397a3a3eb2c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 26 Feb 2015 13:29:36 +1030 Subject: [PATCH] Fix password hashing --- src/Core/Models/User.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Core/Models/User.php b/src/Core/Models/User.php index c71e9b126..5822db69f 100755 --- a/src/Core/Models/User.php +++ b/src/Core/Models/User.php @@ -129,12 +129,23 @@ class User extends Model */ public function changePassword($password) { - $this->password = $password ? static::$hasher->make($password) : null; + $this->password = $password; + $this->raise(new UserPasswordWasChanged($this)); return $this; } + /** + * Store the password as a hash. + * + * @param string $value + */ + public function setPasswordAttribute($value) + { + $this->attributes['password'] = $value ? static::$hasher->make($value) : null; + } + /** * Mark all discussions as read by setting the user's read_time. *