Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password mutator #55

Closed
titoshadow opened this issue Dec 5, 2019 · 3 comments
Closed

Password mutator #55

titoshadow opened this issue Dec 5, 2019 · 3 comments

Comments

@titoshadow
Copy link

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
Copy link
Owner

kossa commented Dec 7, 2019

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

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

@titoshadow
Copy link
Author

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

@kossa
Copy link
Owner

kossa commented Dec 9, 2019

Good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants