本文整理汇总了PHP中Illuminate\Support\Facades\Password::sendResetLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::sendResetLink方法的具体用法?PHP Password::sendResetLink怎么用?PHP Password::sendResetLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Password
的用法示例。
在下文中一共展示了Password::sendResetLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEmail
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postEmail(Request $request)
{
// $this->validate($request, ['email' => 'required|email', 'username' =>'required']);
/*
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
*/
$this->validate($request, ['email' => 'required|email', 'username' => 'required']);
$correo = DB::table('users')->where('username', '=', $request->username)->first();
if (is_null($correo)) {
$response = Password::INVALID_USER;
} else {
if ($correo->email == $request->email) {
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
} else {
$response = Password::INVALID_USER;
}
}
switch ($response) {
case Password::RESET_LINK_SENT:
session()->flash('flash_message', 'Se ha enviado un correo a la dirección de correo asociada.');
return view('auth.password');
case Password::INVALID_USER:
//session()->flash('flash_message_danger', 'No existe un usuario con ese nombre.');
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
示例2: postEmail
/**
* Send a reset link to the given user.
* Overwritten function of ResetsPassword trait.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject(trans('password-recovery.email-title'));
});
}
示例3: postEmail
/**
* @param Request $request
* @throws GeneralException
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function postEmail(Request $request)
{
/**
* First of all check if the input is a valid email
*/
$this->validate($request, ['email' => 'required|email']);
/**
* Make sure user is confirmed before resetting password.
*/
$user = User::where('email', $request->get('email'))->first();
if ($user) {
if ($user->confirmed == 0) {
throw new GeneralException('Your account is not confirmed. Please click the confirmation link in your e-mail, or ' . '<a href="' . route('account.confirm.resend', $user->id) . '">click here</a>' . ' to resend the confirmation e-mail.');
}
} else {
throw new GeneralException('There is no user with that e-mail address.');
}
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
示例4: postEmail
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required']);
$response = Password::sendResetLink($request->only('email'), function ($message) {
$message->subject('Password Reminder');
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
// return Response::json(array(
// 'error'=>false,
// 'content'=>trans($response),
// 'email'=>$request->input('email')
// ),200);
// return Response::json(array(
// 'error'=>false,
// 'content'=>trans($response),
// 'email'=>$request->input('email')
// ),200);
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
// return Response::json(array(
// 'error'=>true,
// 'content'=>trans($response),
// 'email'=>$request->input('email')
// ),200);
}
}
示例5: postEmail
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$email = $request->input('email');
$user = $this->user->pushCriteria(new UserWhereEmailEquals($email))->all()->first();
Audit::log(null, trans('passwords.audit-log.category'), trans('passwords.audit-log.msg-request-reset', ['email' => $email]));
if (is_null($user)) {
Flash::error(trans(Password::INVALID_USER));
return redirect()->back();
} elseif ($user->auth_type !== 'internal') {
Flash::error(trans('passwords.auth_type'));
return redirect()->back();
} else {
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
Flash::success(trans($response));
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
Flash::error(trans($response));
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
}
示例6: postEmail
/**
* Send a reset link to the given user.
*
* @param ResetRequest $request
* @return \Illuminate\Http\Response
*/
public function postEmail(ResetRequest $request)
{
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
示例7: getResetPassword
public function getResetPassword(ResetPassRequest $request)
{
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject('Recuperación de contraseña.');
});
switch ($response) {
case Password::RESET_LINK_SENT:
return $this->simpleArray(['message' => 'Se ha enviado un correo electrónico a su cuenta con instrucciones para recuperar su contraseña.']);
case Password::INVALID_USER:
throw new ResourceException('El usuario no existe');
}
}
示例8: postEmail
/**
* Send a reset link to the given user.
*
* @param \Rukan\AjaxAuth\Requests\PasswordRequest $request
* @return \Illuminate\Http\Response
*/
public function postEmail(PasswordRequest $request)
{
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject(Lang::get('passwords.subject'));
});
switch ($response) {
case Password::RESET_LINK_SENT:
return $request->ajax() ? new JsonResponse(['message' => Lang::get($response)]) : redirect()->back()->with('status', Lang::get($response));
case Password::INVALID_USER:
return $request->ajax() ? new JsonResponse(['message' => Lang::get($response)], 404) : redirect()->back()->withErrors(['email' => Lang::get($response)]);
}
}
示例9: sendResetLinkEmail
/**
* @param SendResetLinkEmailRequest $request
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function sendResetLinkEmail(SendResetLinkEmailRequest $request)
{
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject(trans('strings.emails.auth.password_reset_subject'));
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
示例10: postRemind
/**
* Handle a POST request to remind a user of their password.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postRemind()
{
$result = Password::sendResetLink(Input::only('email'), function ($message, $user) {
$message->subject(trans('reminders.your_password_reminder'));
});
switch ($result) {
case Password::INVALID_USER:
return Redirect::back()->with('error', trans(Password::INVALID_USER));
case Password::RESET_LINK_SENT:
return Redirect::back()->with('success', true);
}
}
示例11: doReset
public function doReset(Request $request)
{
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject('Your Password Reset Link');
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
//return redirect()->route('login.index');
}
示例12: postEmail
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', 'Вам было отправлено письмо с ссылкой на восстановление пароля!');
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => 'Пользователь с таким e-mail не найден!']);
}
}
示例13: sendResetLink
public function sendResetLink($email)
{
$response = Password::sendResetLink($email, function ($message) {
$message->subject('Seu link para reset de senha');
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', 'Um email foi enviado para o reset da senha');
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => 'Não existe nenhum usuário com este e-mail']);
}
return redirect()->back('home.index');
}
示例14: postEmail
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
return view('auth.password', ['mensaje' => 'Se envió un correro para reestablecer su contraseña']);
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
示例15: postEmail
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email|max:255']);
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('message', trans($response))->with('loginTab', 'login');
case Password::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)])->with('loginTab', 'password');
}
}