/**
  * Create a new token for the user.
  *
  * @param  \Auth\Reminders\RemindableInterface  $user
  * @return string
  */
 public function createNewToken(RemindableInterface $user)
 {
     $email = $user->getReminderEmail();
     $value = str_shuffle(sha1($email . spl_object_hash($this) . microtime(true)));
     return hash_hmac('sha256', $value, $this->hashKey);
 }
Example #2
0
 /**
  * Send the password reminder e-mail.
  *
  * @param  \Auth\Reminders\RemindableInterface  $user
  * @param  string    $token
  * @param  \Closure  $callback
  * @return int
  */
 public function sendReminder(RemindableInterface $user, $token, Closure $callback = null)
 {
     // We will use the reminder view that was given to the broker to display the
     // password reminder e-mail. We'll pass a "token" variable into the views
     // so that it may be displayed for an user to click for password reset.
     $view = $this->reminderView;
     return $this->mailer->send($view, compact('token', 'user'), function ($m) use($user, $token, $callback) {
         $m->to($user->getReminderEmail());
         if (!is_null($callback)) {
             call_user_func($callback, $m, $user, $token);
         }
     });
 }