1
I’m having difficulty creating a method that allows me to make a password change form available to logged in users. I would like to use the class methods: App Http Controllers Auth Resetpasswordcontroller.
Currently I have a view with 3 fields, being them:
- current password
- new_password
- nova_senha_confirmation
In the controller I have a method with the code to validate the received data and keep it in the database:
$this->validate($request, [
'senha_atual' => 'required|min:8',
'nova_senha' => 'required|min:8|confirmed']);
if (!Hash::check($request->senha_atual, Auth::user()->password))
{
return redirect('/painel/alterarSenha')->withErrors(['senha_atual' => 'Senha incorreta'])->withInput();;
}
$resultado = $request->user()->fill([
'password' => Hash::make($request->input('nova_senha'))
])->save();
if($resultado)
{
return redirect('/painel')->with(['success' => 'Senha alterada com sucesso!']);
}
But as I mentioned before, I would like to use the methods of controlling Resetpasswordcontroller that extends from Illuminate Foundation Auth Resetspasswords, even to follow a solid, code-free approach.
Eduardo, I’m still seeing this issue. But let’s exchange some ideas, find me at http://github.com/fabiojaniolima
– Fábio Jânio