Browse Source

Fix some password reset stuff.

Taylor Otwell 9 years ago
parent
commit
546c81a190

+ 13 - 13
app/Http/Controllers/Auth/RemindersController.php → app/Http/Controllers/Auth/PasswordController.php

@@ -8,17 +8,17 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  * @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 @@ class RemindersController {
 	}
 
 	/**
-	 * 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 @@ class RemindersController {
 	}
 
 	/**
-	 * Handle a POST request to reset a user's password.
+	 * Reset the given user's password.
 	 *
 	 * @Post("password/reset")
 	 *

+ 4 - 4
app/User.php

@@ -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.

+ 1 - 1
config/app.php

@@ -123,7 +123,7 @@ return [
 		'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',

+ 8 - 8
config/auth.php

@@ -45,22 +45,22 @@ return [
 
 	/*
 	|--------------------------------------------------------------------------
-	| 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,
 	],
 

+ 0 - 0
resources/views/emails/auth/reminder.blade.php → resources/views/emails/auth/password.blade.php