Support the ongoing development of →
posted 10 years ago
Last updated 2 years ago.

Okay, I just needed to get this thing out the door. I've bypassed the standard Laravel stuff and just go direct to the remote system to change the password. Would be interested to know how others do it, but I have something that works for me now.

Last updated 2 years ago.

I'm not sure if I understand your problem, but isn't setting the user's password enough? I use the following method in my User model,

 * Set the password to be hashed when saved
public function setPasswordAttribute($password)
    $this->attributes['password'] = \Hash::make($password);

And then I can simply do the following:

$user = Auth::user();
$user->password = 'MyAwesomePassword';

Then logging in using Auth::check($user->email, 'MyAwesomePassword') should still work.

Last updated 2 years ago.

I have created a new setPassword() method on the user to hash the password and set a flag to show that it is dirty. The save() method recognises the flag and calls up the appropriate remote APIs to set the password. The users are not a simple flat eloquent table - they are at the end of some RPC APIs.

What I wanted to do, is make sure that I am following the "Laravel way" as much as possible, so if the users ever change to a new system or a new API, the main application would not need to know about it and all I would need to change are the Auth drivers.

Thanks :-)

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

judgej judgej Joined 4 Mar 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.