/** * Determine if a token record exists and is valid. * @param \Kbwebs\MultiAuth\PasswordResets\CanResetPassword $user * @param string $token * @param string $type * @return bool */ public function exists(CanResetPasswordContract $user, $token, $type) { $email = $user->getEmailForPasswordReset(); $token = (array) $this->getTable()->where('email', $email)->where('token', $token)->where('type', $type)->first(); return $token && !$this->tokenExpired($token); }
/** * Send the password reset link via e-mail. * @param \Kbwebs\MultiAuth\PasswordResets\CanResetPassword $user * @param string $token * @param \Closure|null $callback * @return int */ public function emailResetLink(CanResetPasswordContract $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->emailView; $type = $this->type; return $this->mailer->send($view[$type], compact('token', 'user', 'type'), function ($m) use($user, $token, $type, $callback) { $m->to($user->getEmailForPasswordReset()); if (!is_null($callback)) { call_user_func($callback, $m, $user, $type, $token); } }); }