php - Laravel 5 password reset not working -


i working on laravel 5 ecommerce web portal.

i having issue when user updates password using ready made scripts.

the issue can send link customer without issue , customer can change password also. when logged out , re-logging in, error invalid credentials.

in routes.php, have this:

route::controllers([     'auth' => 'auth\authcontroller',     'password' => 'auth\passwordcontroller', ]); 

this login page:

<form class="form-horizontal" role="form" method="post" action="{{ url('/login') }}">     <input type="hidden" name="_token" value="{{ csrf_token() }}">      <div class="form-group">         <label class="col-md-4 control-label">e-mail address</label>         <div class="col-md-6">             <input type="email" class="form-control" name="email" value="{{ old('email') }}">         </div>     </div>      <div class="form-group">         <label class="col-md-4 control-label">password</label>         <div class="col-md-6">             <input type="password" class="form-control" name="password">         </div>     </div>      <div class="form-group">         <div class="col-md-4"></div>         <div class="col-md-4">             <a href="{{url('/password/email')}}">forgot password</a>         </div>     </div>      <div class="form-group">         <div class="col-md-6 col-md-offset-4">             <button type="submit" class="btn btn-primary btn-block">login</button>         </div>     </div> </form> 

i cannot login again after logged out once password has been reset.

edit 1:

when login button clicked on login form page, postlogin method called. here's code

public function postlogin( request $request ) {     $this->validate( $request, [         'email'     => ['required', 'exists:users,email,role,customer'],         'password'  => 'required'     ]);      $credentials = $request->only('email', 'password');      if ( \auth::attempt($credentials) ) {         \session::flash('logged_in', 'you have logged in.');         return redirect('/');     }      return redirect('/login')->withinput($request->all())->witherrors(['email' => 'invalid email address or password']); } 

edit 2:

i realize login not checking hash , hence returning false, on doing dd(\hash::check($request->password, $user->password)), after updating password , re-logging in. issue ?

where have made mistake ? kindly guide me.

thanks in advance.

p.s.: using defaults update password, rest all, have made controllers , models working fine without issue.

if new password not work after changing goes wrong when changing password.

most suspect encryption. can possible not using hash::make($password) , saving in plaintext format.

you can doublecheck if hash saved correctly db function hash::check($password, $hash);

during login can check password as

public function postlogin( request $request ) {     $user=user::where('email', $request->email);     log::debug("testing $request->password $user->password ". hash::check($request->password, $user->password)); } 

if hash::check false went wrong when saving new password. $user->password must in hashed form.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -