Refactor
This commit is contained in:
parent
fa1c780786
commit
389de2aa84
|
|
@ -141,17 +141,17 @@ class User extends Model
|
||||||
/**
|
/**
|
||||||
* Change password of the user.
|
* Change password of the user.
|
||||||
*
|
*
|
||||||
* @param string $new_passwd New password that will be set.
|
* @param string $password New password that will be set.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function changePassword($new_passwd)
|
public function changePassword($password)
|
||||||
{
|
{
|
||||||
$responses = event(new EncryptUserPassword($new_passwd, $this));
|
$responses = event(new EncryptUserPassword($password, $this));
|
||||||
|
|
||||||
if (isset($responses[0])) {
|
if (isset($responses[0])) {
|
||||||
$this->password = $responses[0]; // @codeCoverageIgnore
|
$this->password = $responses[0]; // @codeCoverageIgnore
|
||||||
} else {
|
} else {
|
||||||
$this->password = app('cipher')->hash($new_passwd, config('secure.salt'));
|
$this->password = app('cipher')->hash($password, config('secure.salt'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->save();
|
return $this->save();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user