Fix some password reset stuff.
This commit is contained in:
parent
f2279c0210
commit
546c81a190
|
@ -8,17 +8,17 @@
|
||||||
* @Middleware("csrf")
|
* @Middleware("csrf")
|
||||||
* @Middleware("guest")
|
* @Middleware("guest")
|
||||||
*/
|
*/
|
||||||
class RemindersController {
|
class PasswordController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The password reminder implementation.
|
* The password broker implementation.
|
||||||
*
|
*
|
||||||
* @var PasswordBroker
|
* @var PasswordBroker
|
||||||
*/
|
*/
|
||||||
protected $passwords;
|
protected $passwords;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new password reminder controller instance.
|
* Create a new password controller instance.
|
||||||
*
|
*
|
||||||
* @param PasswordBroker $passwords
|
* @param PasswordBroker $passwords
|
||||||
* @return void
|
* @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
|
* @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
|
* @param Request $request
|
||||||
* @return Response
|
* @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:
|
case PasswordBroker::INVALID_USER:
|
||||||
return redirect()->back()->with('error', trans($response));
|
return redirect()->back()->with('error', trans($response));
|
||||||
|
|
||||||
case PasswordBroker::REMINDER_SENT:
|
case PasswordBroker::RESET_LINK_SENT:
|
||||||
return redirect()->back()->with('status', trans($response));
|
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")
|
* @Post("password/reset")
|
||||||
*
|
*
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
use Illuminate\Auth\UserTrait;
|
use Illuminate\Auth\UserTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Auth\Reminders\RemindableTrait;
|
|
||||||
use Illuminate\Contracts\Auth\User as UserContract;
|
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.
|
* The database table used by the model.
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
'Illuminate\Pagination\PaginationServiceProvider',
|
'Illuminate\Pagination\PaginationServiceProvider',
|
||||||
'Illuminate\Queue\QueueServiceProvider',
|
'Illuminate\Queue\QueueServiceProvider',
|
||||||
'Illuminate\Redis\RedisServiceProvider',
|
'Illuminate\Redis\RedisServiceProvider',
|
||||||
'Illuminate\Auth\Reminders\ReminderServiceProvider',
|
'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
|
||||||
'Illuminate\Session\SessionServiceProvider',
|
'Illuminate\Session\SessionServiceProvider',
|
||||||
'Illuminate\Translation\TranslationServiceProvider',
|
'Illuminate\Translation\TranslationServiceProvider',
|
||||||
'Illuminate\Validation\ValidationServiceProvider',
|
'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
|
| Here you may set the options for resetting passwords including the view
|
||||||
| that should be used as your password reminder e-mail. You will also
|
| that is your password reset e-mail. You can also set the name of the
|
||||||
| be able to set the name of the table that holds the reset tokens.
|
| 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
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
| they have less time to be guessed. You may change this as needed.
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'reminder' => [
|
'password' => [
|
||||||
'email' => 'emails.auth.reminder',
|
'email' => 'emails.auth.password',
|
||||||
'table' => 'password_reminders',
|
'table' => 'password_resets',
|
||||||
'expire' => 60,
|
'expire' => 60,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue