本文整理汇总了PHP中Password::sendResetLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::sendResetLink方法的具体用法?PHP Password::sendResetLink怎么用?PHP Password::sendResetLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Password
的用法示例。
在下文中一共展示了Password::sendResetLink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$user = $this->updateOrCreate($request);
\Password::sendResetLink(['email' => $user->email], function (Message $message) {
$message->subject('Velkommen til ub-baser');
});
return redirect()->action('Admin\\UserController@index')->with('status', 'En epost er sendt til brukeren med instruksjoner for å sette passord.');
}
示例2: postEmail
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|exists:users,email,active,1']);
$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)]);
}
}
示例3: postRemind
/**
* Handle a POST request to remind a user of their password.
*
* @return Response
*/
public function postRemind()
{
\App::make('route');
\Config::set('auth.defaults.passwords', 'panel');
$response = \Password::sendResetLink(Input::only('email'), function ($message) {
$message->subject('Password Reminder');
});
switch ($response) {
case PasswordBrokerContract::INVALID_USER:
return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'error');
case PasswordBrokerContract::RESET_LINK_SENT:
return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'info');
}
}
示例4: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$credentials = ['email' => $this->argument('email')];
$user = User::firstOrNew($credentials);
if (!$user->isDirty()) {
$this->info('User already exists');
return;
}
$user->name = $this->argument('name');
$user->rights = $this->option('admin') ? ['admin'] : [];
$user->save();
\Password::sendResetLink($credentials, function (Message $message) {
$message->subject('Velkommen til ub-baser');
});
$this->info('User created, email sent to ' . $user->email . '.');
}
示例5: password_request
public function password_request()
{
$credentials = array('email' => Input::get('email'));
$response = Password::sendResetLink($credentials, function ($message) {
$message->subject('Password Reset Info');
});
switch ($response) {
case PasswordBroker::RESET_LINK_SENT:
return Redirect::to('login')->with(array('note' => trans($response), 'note_type' => 'success'));
case PasswordBroker::INVALID_USER:
return redirect()->back()->with(array('note' => trans($response), 'note_type' => 'error'));
}
}
示例6: sendReminder
/**
* Send reminder email.
*
* @return Response
*/
public function sendReminder()
{
$result = Password::sendResetLink(Input::only('email'), function ($message, $user) {
$message->subject(trans('login.reminder_subject'));
});
switch ($result) {
case Password::INVALID_USER:
return Redirect::back()->with('error', trans('login.wrong_creds'));
case Password::RESET_LINK_SENT:
return Redirect::back()->with('status', trans('login.reminder_sent'));
}
}