Dan Brown

Added password reset functionaility. Fixes #27.

...@@ -20,10 +20,10 @@ class PasswordController extends Controller ...@@ -20,10 +20,10 @@ class PasswordController extends Controller
20 20
21 use ResetsPasswords; 21 use ResetsPasswords;
22 22
23 + protected $redirectTo = '/';
24 +
23 /** 25 /**
24 * Create a new password controller instance. 26 * Create a new password controller instance.
25 - *
26 - * @return void
27 */ 27 */
28 public function __construct() 28 public function __construct()
29 { 29 {
......
...@@ -86,6 +86,13 @@ Route::group(['middleware' => 'auth'], function() { ...@@ -86,6 +86,13 @@ Route::group(['middleware' => 'auth'], function() {
86 86
87 }); 87 });
88 88
89 +// Login/Logout routes
89 Route::get('/login', 'Auth\AuthController@getLogin'); 90 Route::get('/login', 'Auth\AuthController@getLogin');
90 Route::post('/login', 'Auth\AuthController@postLogin'); 91 Route::post('/login', 'Auth\AuthController@postLogin');
91 Route::get('/logout', 'Auth\AuthController@getLogout'); 92 Route::get('/logout', 'Auth\AuthController@getLogout');
93 +// Password reset link request routes...
94 +Route::get('/password/email', 'Auth\PasswordController@getEmail');
95 +Route::post('/password/email', 'Auth\PasswordController@postEmail');
96 +// Password reset routes...
97 +Route::get('/password/reset/{token}', 'Auth\PasswordController@getReset');
98 +Route::post('/password/reset', 'Auth\PasswordController@postReset');
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -54,7 +54,7 @@ return [ ...@@ -54,7 +54,7 @@ return [
54 | 54 |
55 */ 55 */
56 56
57 - 'from' => ['address' => null, 'name' => null], 57 + 'from' => ['address' => env('MAIL_FROM', 'mail@bookstackapp.com'), 'name' => 'BookStack'],
58 58
59 /* 59 /*
60 |-------------------------------------------------------------------------- 60 |--------------------------------------------------------------------------
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
29 <div class="form-group"> 29 <div class="form-group">
30 <label for="password">Password</label> 30 <label for="password">Password</label>
31 @include('form/password', ['name' => 'password']) 31 @include('form/password', ['name' => 'password'])
32 + <span class="block small"><a href="/password/email">Forgot Password?</a></span>
32 </div> 33 </div>
33 34
34 <div class="from-group"> 35 <div class="from-group">
......
1 +@extends('public')
2 +
3 +@section('body-class', 'image-cover login')
4 +
5 +@section('sidebar')
6 +
7 +
8 + <div class="text-center">
9 + <div class="center-box text-left">
10 + <h1>Reset Password</h1>
11 +
12 + <p class="muted small">Enter your email below and you will be sent an email with a password reset link.</p>
13 +
14 + <form action="/password/email" method="POST">
15 + {!! csrf_field() !!}
16 +
17 + <div class="form-group">
18 + <label for="email">Email</label>
19 + @include('form/text', ['name' => 'email'])
20 + </div>
21 +
22 + <div class="from-group">
23 + <button class="button block pos">Send Reset Link</button>
24 + </div>
25 + </form>
26 + </div>
27 + </div>
28 +
29 +@stop
...\ No newline at end of file ...\ No newline at end of file
1 +@extends('public')
2 +
3 +@section('body-class', 'image-cover login')
4 +
5 +@section('sidebar')
6 +
7 +
8 + <div class="text-center">
9 + <div class="center-box text-left">
10 + <h1>Reset Password</h1>
11 +
12 + <form action="/password/reset" method="POST">
13 + {!! csrf_field() !!}
14 + <input type="hidden" name="token" value="{{ $token }}">
15 +
16 + <div class="form-group">
17 + <label for="email">Email</label>
18 + @include('form/text', ['name' => 'email'])
19 + </div>
20 +
21 + <div class="form-group">
22 + <label for="password">Password</label>
23 + @include('form/password', ['name' => 'password'])
24 + </div>
25 +
26 + <div class="form-group">
27 + <label for="password_confirmation">Confirm Password</label>
28 + @include('form/password', ['name' => 'password_confirmation'])
29 + </div>
30 +
31 + <div class="from-group">
32 + <button class="button block pos">Reset Password</button>
33 + </div>
34 + </form>
35 + </div>
36 + </div>
37 +
38 +@stop
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 +<html xmlns="http://www.w3.org/1999/xhtml" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
3 +<head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
4 + <meta name="viewport" content="width=device-width" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
5 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" />
6 + <title>Password Reset</title>
7 + <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
8 +
9 + * {
10 + margin: 0;
11 + padding: 0;
12 + font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
13 + font-size: 100%;
14 + line-height: 1.6;
15 + }
16 +
17 + img {
18 + max-width: 100%;
19 + }
20 +
21 + body {
22 + -webkit-font-smoothing: antialiased;
23 + -webkit-text-size-adjust: none;
24 + width: 100%!important;
25 + height: 100%;
26 + }
27 +
28 +
29 +
30 + a {
31 + color: #348eda;
32 + }
33 +
34 + .btn-primary {
35 + text-decoration: none;
36 + color: #FFF;
37 + background-color: #348eda;
38 + border: solid #348eda;
39 + border-width: 10px 20px;
40 + line-height: 2;
41 + font-weight: bold;
42 + margin-right: 10px;
43 + text-align: center;
44 + cursor: pointer;
45 + display: inline-block;
46 + border-radius: 4px;
47 + }
48 +
49 + .btn-secondary {
50 + text-decoration: none;
51 + color: #FFF;
52 + background-color: #aaa;
53 + border: solid #aaa;
54 + border-width: 10px 20px;
55 + line-height: 2;
56 + font-weight: bold;
57 + margin-right: 10px;
58 + text-align: center;
59 + cursor: pointer;
60 + display: inline-block;
61 + border-radius: 25px;
62 + }
63 +
64 + .last {
65 + margin-bottom: 0;
66 + }
67 +
68 + .first {
69 + margin-top: 0;
70 + }
71 +
72 + .padding {
73 + padding: 10px 0;
74 + }
75 +
76 +
77 +
78 + table.body-wrap {
79 + width: 100%;
80 + padding: 20px;
81 + }
82 +
83 + table.body-wrap .container {
84 + border: 1px solid #f0f0f0;
85 + }
86 +
87 +
88 +
89 +
90 + h1, h2, h3 {
91 + font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
92 + color: #444;
93 + margin: 10px 0 10px;
94 + line-height: 1.2;
95 + font-weight: 200;
96 + }
97 +
98 + h1 {
99 + font-size: 36px;
100 + }
101 + h2 {
102 + font-size: 28px;
103 + }
104 + h3 {
105 + font-size: 22px;
106 + }
107 +
108 + p, ul, ol {
109 + margin-bottom: 10px;
110 + font-weight: normal;
111 + font-size: 14px;
112 + color: #888888;
113 + }
114 +
115 + ul li, ol li {
116 + margin-left: 5px;
117 + list-style-position: inside;
118 + }
119 +
120 +
121 +
122 +
123 + .container {
124 + display: block!important;
125 + max-width: 600px!important;
126 + margin: 0 auto!important;
127 + clear: both!important;
128 + }
129 +
130 +
131 + .body-wrap .container {
132 + padding: 20px;
133 + }
134 +
135 +
136 + .content {
137 + max-width: 600px;
138 + margin: 0 auto;
139 + display: block;
140 + }
141 +
142 +
143 + .content table {
144 + width: 100%;
145 + }
146 +
147 + </style>
148 + </head>
149 +
150 + <body bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;" >
151 +
152 + <!-- body -->
153 + <table class="body-wrap" bgcolor="#f6f6f6" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;" >
154 + <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
155 + <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" ></td>
156 + <td class="container" bgcolor="#FFFFFF" style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;" >
157 +
158 + <!-- content -->
159 + <div class="content" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;" >
160 + <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;" >
161 + <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
162 + <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
163 + <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;" >Password Reset</h1>
164 + <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;" >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.</p>
165 + <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;" >
166 + <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" >
167 + <td class="padding" style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;" >
168 + <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;" ><a class="btn-primary" href="{{ url('password/reset/'.$token) }}" style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;" >Click here to reset your password</a></p>
169 + </td>
170 + </tr>
171 + </table>
172 + </td>
173 + </tr>
174 + </table>
175 + </div>
176 + <!-- /content -->
177 +
178 + </td>
179 + <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;" ></td>
180 + </tr>
181 + </table>
182 + <!-- /body -->
183 +
184 +
185 + </body>
186 + </html>
...\ No newline at end of file ...\ No newline at end of file