We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f0472d commit da2a739Copy full SHA for da2a739
src/Traits/HasPassword.php
@@ -16,8 +16,11 @@ public static function bootHasPassword(){
16
static::updating(function($model) {
17
$passwordFieldName = $model->getPasswordFieldName();
18
$modelMutator = new ModelMutator($model);
19
- if(!empty($model->$passwordFieldName)){
+ $currentHashedPassword = $model->getOriginal('password');
20
+ if(!empty($model->$passwordFieldName) && $model->$passwordFieldName != $currentHashedPassword){
21
$model = $modelMutator->hashPassword($passwordFieldName)->getModel();
22
+ }else{
23
+ unset($model->password);
24
}
25
});
26
@@ -29,4 +32,4 @@ public function getPasswordFieldName(){
29
32
return 'password';
30
33
31
34
-}
35
+}
0 commit comments