2

code example come from this

I confused on example code I didn't login and click link from email
and get user id from?

 $user = Sentry::findUserById(1);
krissanawat
  • 616
  • 1
  • 11
  • 36

2 Answers2

4

the example it not clear I found another function

$user = Sentry::findUserByResetPasswordCode($code);

krissanawat
  • 616
  • 1
  • 11
  • 36
0

You can find user by the code, then you can login into application to change the password

try
{
  $user = Sentry::findUserByResetPasswordCode($code);

  if ($user->checkResetPasswordCode($code)){
    Sentry::login($user, false);
    return Redirect::route('application.reset_password');
  }
}
catch(\Cartalyst\Sentry\Users\UserNotFoundException $e)
{
  return Redirect::route('login')->with('message' , 'Code not valid');
}
Jose Rojas
  • 3,490
  • 3
  • 26
  • 40