kossa/laradminator

Password mutator

Closed this issue · 3 comments

With "setUserPassword" mutator, when using laravel auth facade, it will fail (not sure it fails out of the box) when editing password, since "password" field is hidden, it hashes a null value.

Please test it, just in case I' ve fixed it with this guard:

    public function setPasswordAttribute($password)
    {
        if(Hash::needsRehash($password))
            $password = Hash::make($password);

        $this->attributes['password'] = $password;
    }
kossa commented

For my case I dont call hash already exists in User.php

https://github.com/kossa/laradminator/blob/master/app/User.php#L95

Okey, then my fix is only necessary if changing the auth facade :)

kossa commented

Good :)