Fix some password reset stuff.
This commit is contained in:
parent
f2279c0210
commit
546c81a190
|
@ -8,17 +8,17 @@
|
|||
* @Middleware("csrf")
|
||||
* @Middleware("guest")
|
||||
*/
|
||||
class RemindersController {
|
||||
class PasswordController {
|
||||
|
||||
/**
|
||||
* The password reminder implementation.
|
||||
* The password broker implementation.
|
||||
*
|
||||
* @var PasswordBroker
|
||||
*/
|
||||
protected $passwords;
|
||||
|
||||
/**
|
||||
* Create a new password reminder controller instance.
|
||||
* Create a new password controller instance.
|
||||
*
|
||||
* @param PasswordBroker $passwords
|
||||
* @return void
|
||||
|
@ -29,33 +29,33 @@ public function __construct(PasswordBroker $passwords)
|
|||
}
|
||||
|
||||
/**
|
||||
* Display the password reminder view.
|
||||
* Display the form to request a password reset link.
|
||||
*
|
||||
* @Get("password/remind")
|
||||
* @Get("password/email")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function showReminderForm()
|
||||
public function showResetRequestForm()
|
||||
{
|
||||
return view('password.remind');
|
||||
return view('password.email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a POST request to remind a user of their password.
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @Post("password/remind")
|
||||
* @Post("password/email")
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function sendPasswordResetEmail(Request $request)
|
||||
public function sendPasswordResetLink(Request $request)
|
||||
{
|
||||
switch ($response = $this->passwords->remind($request->only('email')))
|
||||
switch ($response = $this->passwords->sendResetLink($request->only('email')))
|
||||
{
|
||||
case PasswordBroker::INVALID_USER:
|
||||
return redirect()->back()->with('error', trans($response));
|
||||
|
||||
case PasswordBroker::REMINDER_SENT:
|
||||
case PasswordBroker::RESET_LINK_SENT:
|
||||
return redirect()->back()->with('status', trans($response));
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public function showPasswordResetForm($token = null)
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle a POST request to reset a user's password.
|
||||
* Reset the given user's password.
|
||||
*
|
||||
* @Post("password/reset")
|
||||
*
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
use Illuminate\Auth\UserTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Auth\Reminders\RemindableTrait;
|
||||
use Illuminate\Contracts\Auth\User as UserContract;
|
||||
use Illuminate\Contracts\Auth\Remindable as RemindableContract;
|
||||
use Illuminate\Auth\Reminders\CanResetPasswordTrait;
|
||||
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
||||
|
||||
class User extends Model implements UserContract, RemindableContract {
|
||||
class User extends Model implements UserContract, CanResetPasswordContract {
|
||||
|
||||
use UserTrait, RemindableTrait;
|
||||
use UserTrait, CanResetPasswordTrait;
|
||||
|
||||
/**
|
||||
* The database table used by the model.
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
'Illuminate\Pagination\PaginationServiceProvider',
|
||||
'Illuminate\Queue\QueueServiceProvider',
|
||||
'Illuminate\Redis\RedisServiceProvider',
|
||||
'Illuminate\Auth\Reminders\ReminderServiceProvider',
|
||||
'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
|
||||
'Illuminate\Session\SessionServiceProvider',
|
||||
'Illuminate\Translation\TranslationServiceProvider',
|
||||
'Illuminate\Validation\ValidationServiceProvider',
|
||||
|
|
|
@ -45,22 +45,22 @@
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reminder Settings
|
||||
| Password Reset Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may set the settings for password reminders, including a view
|
||||
| that should be used as your password reminder e-mail. You will also
|
||||
| be able to set the name of the table that holds the reset tokens.
|
||||
| Here you may set the options for resetting passwords including the view
|
||||
| that is your password reset e-mail. You can also set the name of the
|
||||
| table that maintains all of the reset tokens for your application.
|
||||
|
|
||||
| The "expire" time is the number of minutes that the reminder should be
|
||||
| The expire time is the number of minutes that the reset token should be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'reminder' => [
|
||||
'email' => 'emails.auth.reminder',
|
||||
'table' => 'password_reminders',
|
||||
'password' => [
|
||||
'email' => 'emails.auth.password',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in New Issue