本文整理汇总了PHP中Illuminate\Contracts\Auth\CanResetPassword::getEmailForPasswordReset方法的典型用法代码示例。如果您正苦于以下问题:PHP CanResetPassword::getEmailForPasswordReset方法的具体用法?PHP CanResetPassword::getEmailForPasswordReset怎么用?PHP CanResetPassword::getEmailForPasswordReset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Auth\CanResetPassword
的用法示例。
在下文中一共展示了CanResetPassword::getEmailForPasswordReset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNewPassword
public function sendNewPassword(CanResetPassword $user)
{
$password = str_random(8);
$user->password = $password;
$user->save();
$this->mailer->send('auth::emails.new_password', compact('user', 'password'), function ($m) use($user) {
$m->to($user->getEmailForPasswordReset());
});
}
示例2: requestChangePassword
/**
* Generate a token for password change and saves it in
* the Reminder table with the email of the
* user.
*
* @param CanResetPasswordContract $account An existent user.
*
* @return string Password reset token.
*/
public function requestChangePassword(CanResetPasswordContract $account)
{
$token = $this->generateToken();
$values = ['email' => $account->getEmailForPasswordReset(), 'token' => $token, 'created_at' => new \DateTime()];
$reminder = $this->getReminder()->fill($values);
$reminder->save();
$this->sendEmail($account, $token);
return $token;
}
示例3: emailResetLink
/**
* Send the password reset link via e-mail.
* Overrides to use the mail queue.
*
* @override
* @see PasswordBroker::emailResetLink()
*
* @param \Illuminate\Contracts\Auth\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;
return $this->mailer->queue($view, compact('token', 'user'), function ($m) use($user, $token, $callback) {
$m->to($user->getEmailForPasswordReset());
if (!is_null($callback)) {
call_user_func($callback, $m, $user, $token);
}
});
}
示例4: exists
/**
* Determine if a token record exists and is valid.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $token
* @return bool
*/
public function exists(CanResetPasswordContract $user, $token)
{
$email = $user->getEmailForPasswordReset();
$token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first();
return $token && !$this->tokenExpired($token);
}
示例5: exists
/**
* Determine if a reminder record exists and is valid.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $token
*
* @return bool
*/
public function exists(CanResetPassword $user, $token)
{
$email = $user->getEmailForPasswordReset();
$reminder = $this->makeSelect()->where('o.email = :email')->andWhere('o.token = :token')->setParameter('email', $email)->setParameter('token', $token)->getQuery()->getOneOrNullResult();
return $reminder != null && !$this->reminderExpired($reminder);
}
示例6: createEmailResetLink
/**
* Send the password reset link via e-mail.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $token
* @param \stdClass $viewData
* @param \Closure|null $callback
*
* @return int
*/
private function createEmailResetLink(CanResetPasswordContract $user, $token, \stdClass $viewData, 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.
$email = $viewData;
$email->token = $token;
$this->mailer->send($this->emailView, compact('email'), function ($m) use($user, $token, $callback) {
/**
* @var \Illuminate\Mail\Message $m
*/
$m->to($user->getEmailForPasswordReset());
if (!is_null($callback)) {
call_user_func($callback, $m, $user, $token);
}
});
}
示例7: createNewToken
/**
* Create a new token for the user.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @return string
*/
public function createNewToken(CanResetPasswordContract $user)
{
$email = $user->getEmailForPasswordReset();
$value = str_shuffle(sha1($email . spl_object_hash($this) . microtime(true)));
return hash_hmac('sha1', $value, $this->hashKey);
}
示例8: emailResetLink
/**
* Send the password reset link via e-mail.
*
* @param \Illuminate\Contracts\Auth\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;
try {
$this->mailer->send($view, compact('token', 'user'), function ($message) use($user, $token, $callback) {
$message->from($user->getEmailForPasswordReset());
$message->to($user->getEmailForPasswordReset());
if (!is_null($callback)) {
call_user_func($callback, $message, $user, $token);
}
});
return Redirect('/')->with('mensaje', 'Se ha enviado el link de cambio de contraseña a tu correo electrónico.');
} catch (\Exception $ex) {
switch ($ex->getCode()) {
case 550:
break;
default:
return Redirect('/')->with('mensaje', 'El servidor de correos no ha realizado el envío del link del cambio de contraseña.');
}
}
}