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.
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';
$user->save();
Then logging in using Auth::check($user->email, 'MyAwesomePassword') should still work.
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 :-)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community