From b68f2803fc7ec87b8f12a2a888028a4908bcdb49 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 23 Aug 2015 15:46:02 +0100 Subject: [PATCH] Added password reset functionaility. Fixes #27. --- .../Controllers/Auth/PasswordController.php | 4 +- app/Http/routes.php | 7 + config/mail.php | 2 +- resources/views/auth/login.blade.php | 1 + resources/views/auth/password.blade.php | 29 +++ resources/views/auth/reset.blade.php | 38 ++++ resources/views/emails/password.blade.php | 186 ++++++++++++++++++ 7 files changed, 264 insertions(+), 3 deletions(-) create mode 100644 resources/views/auth/password.blade.php create mode 100644 resources/views/auth/reset.blade.php create mode 100644 resources/views/emails/password.blade.php diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 5f3747b4a..053979288 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -20,10 +20,10 @@ class PasswordController extends Controller use ResetsPasswords; + protected $redirectTo = '/'; + /** * Create a new password controller instance. - * - * @return void */ public function __construct() { diff --git a/app/Http/routes.php b/app/Http/routes.php index a6cda78e6..4811b74d0 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -86,6 +86,13 @@ Route::group(['middleware' => 'auth'], function() { }); +// Login/Logout routes Route::get('/login', 'Auth\AuthController@getLogin'); Route::post('/login', 'Auth\AuthController@postLogin'); Route::get('/logout', 'Auth\AuthController@getLogout'); +// Password reset link request routes... +Route::get('/password/email', 'Auth\PasswordController@getEmail'); +Route::post('/password/email', 'Auth\PasswordController@postEmail'); +// Password reset routes... +Route::get('/password/reset/{token}', 'Auth\PasswordController@getReset'); +Route::post('/password/reset', 'Auth\PasswordController@postReset'); \ No newline at end of file diff --git a/config/mail.php b/config/mail.php index a22807e71..a45145309 100644 --- a/config/mail.php +++ b/config/mail.php @@ -54,7 +54,7 @@ return [ | */ - 'from' => ['address' => null, 'name' => null], + 'from' => ['address' => env('MAIL_FROM', 'mail@bookstackapp.com'), 'name' => 'BookStack'], /* |-------------------------------------------------------------------------- diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 97062cb79..dbf6db87b 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -29,6 +29,7 @@
@include('form/password', ['name' => 'password']) + Forgot Password?
diff --git a/resources/views/auth/password.blade.php b/resources/views/auth/password.blade.php new file mode 100644 index 000000000..6b9f46ec7 --- /dev/null +++ b/resources/views/auth/password.blade.php @@ -0,0 +1,29 @@ +@extends('public') + +@section('body-class', 'image-cover login') + +@section('sidebar') + + +
+
+

Reset Password

+ +

Enter your email below and you will be sent an email with a password reset link.

+ +
+ {!! csrf_field() !!} + +
+ + @include('form/text', ['name' => 'email']) +
+ +
+ +
+
+
+
+ +@stop \ No newline at end of file diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.php new file mode 100644 index 000000000..6762ef2f0 --- /dev/null +++ b/resources/views/auth/reset.blade.php @@ -0,0 +1,38 @@ +@extends('public') + +@section('body-class', 'image-cover login') + +@section('sidebar') + + +
+
+

Reset Password

+ +
+ {!! csrf_field() !!} + + +
+ + @include('form/text', ['name' => 'email']) +
+ +
+ + @include('form/password', ['name' => 'password']) +
+ +
+ + @include('form/password', ['name' => 'password_confirmation']) +
+ +
+ +
+
+
+
+ +@stop \ No newline at end of file diff --git a/resources/views/emails/password.blade.php b/resources/views/emails/password.blade.php new file mode 100644 index 000000000..6d4827272 --- /dev/null +++ b/resources/views/emails/password.blade.php @@ -0,0 +1,186 @@ + + + + + + Password Reset + + + + + + + + + + + + +
+ + +
+ + + + +
+

Password Reset

+

A password reset was requested for this email address on the application found at {{url('/')}}. If you did not request a password change please ignore this email.

+ + + + +
+

Click here to reset your password

+
+
+
+ + +
+ + + + + \ No newline at end of file