@@ -5,49 +5,49 @@ |
||
5 | 5 | |
6 | 6 | class CreateUsersTable extends Migration { |
7 | 7 | |
8 | - /** |
|
9 | - * @author Andrea Marco Sartori |
|
10 | - * @var string $table The name of the users table. |
|
11 | - */ |
|
12 | - protected $table; |
|
8 | + /** |
|
9 | + * @author Andrea Marco Sartori |
|
10 | + * @var string $table The name of the users table. |
|
11 | + */ |
|
12 | + protected $table; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Set the name of the users table. |
|
16 | - * |
|
17 | - * @author Andrea Marco Sartori |
|
18 | - * @return void |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->table = config('auth.table'); |
|
23 | - } |
|
14 | + /** |
|
15 | + * Set the name of the users table. |
|
16 | + * |
|
17 | + * @author Andrea Marco Sartori |
|
18 | + * @return void |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->table = config('auth.table'); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Run the migrations. |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function up() |
|
31 | - { |
|
32 | - Schema::create($this->table, function(Blueprint $table) |
|
33 | - { |
|
34 | - $table->increments('id'); |
|
35 | - $table->string('email')->unique(); |
|
36 | - $table->string('password', 60); |
|
37 | - $table->string('reset_token', 10)->nullable(); |
|
38 | - $table->rememberToken(); |
|
39 | - $table->timestamps(); |
|
40 | - }); |
|
41 | - } |
|
25 | + /** |
|
26 | + * Run the migrations. |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function up() |
|
31 | + { |
|
32 | + Schema::create($this->table, function(Blueprint $table) |
|
33 | + { |
|
34 | + $table->increments('id'); |
|
35 | + $table->string('email')->unique(); |
|
36 | + $table->string('password', 60); |
|
37 | + $table->string('reset_token', 10)->nullable(); |
|
38 | + $table->rememberToken(); |
|
39 | + $table->timestamps(); |
|
40 | + }); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Reverse the migrations. |
|
45 | - * |
|
46 | - * @return void |
|
47 | - */ |
|
48 | - public function down() |
|
49 | - { |
|
50 | - Schema::drop($this->table); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Reverse the migrations. |
|
45 | + * |
|
46 | + * @return void |
|
47 | + */ |
|
48 | + public function down() |
|
49 | + { |
|
50 | + Schema::drop($this->table); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | } |
@@ -14,187 +14,187 @@ |
||
14 | 14 | |
15 | 15 | class AuthController extends Controller { |
16 | 16 | |
17 | - /** |
|
18 | - * @author Andrea Marco Sartori |
|
19 | - * @var Illuminate\Contracts\Bus\Dispatcher $bus Bus dispatcher. |
|
20 | - */ |
|
21 | - protected $bus; |
|
22 | - |
|
23 | - /** |
|
24 | - * @author Andrea Marco Sartori |
|
25 | - * @var array $loginPipes List of pipes for the login process. |
|
26 | - */ |
|
27 | - protected $loginPipes = ['DispatchEvent', 'Throttle']; |
|
28 | - |
|
29 | - /** |
|
30 | - * @author Andrea Marco Sartori |
|
31 | - * @var array $logoutPipes List of pipes for the logout process. |
|
32 | - */ |
|
33 | - protected $logoutPipes = ['DispatchEvent']; |
|
34 | - |
|
35 | - /** |
|
36 | - * @author Andrea Marco Sartori |
|
37 | - * @var array $registerPipes List of pipes for the register process. |
|
38 | - */ |
|
39 | - protected $registerPipes = ['DispatchEvent', 'Login', 'Notify', 'Hash']; |
|
40 | - |
|
41 | - /** |
|
42 | - * @author Andrea Marco Sartori |
|
43 | - * @var array $recoverPipes List of pipes for the password recover process. |
|
44 | - */ |
|
45 | - protected $recoverPipes = ['DispatchEvent', 'Notify', 'Store']; |
|
46 | - |
|
47 | - /** |
|
48 | - * @author Andrea Marco Sartori |
|
49 | - * @var array $resetPipes List of pipes for the password reset process. |
|
50 | - */ |
|
51 | - protected $resetPipes = ['DispatchEvent']; |
|
17 | + /** |
|
18 | + * @author Andrea Marco Sartori |
|
19 | + * @var Illuminate\Contracts\Bus\Dispatcher $bus Bus dispatcher. |
|
20 | + */ |
|
21 | + protected $bus; |
|
22 | + |
|
23 | + /** |
|
24 | + * @author Andrea Marco Sartori |
|
25 | + * @var array $loginPipes List of pipes for the login process. |
|
26 | + */ |
|
27 | + protected $loginPipes = ['DispatchEvent', 'Throttle']; |
|
28 | + |
|
29 | + /** |
|
30 | + * @author Andrea Marco Sartori |
|
31 | + * @var array $logoutPipes List of pipes for the logout process. |
|
32 | + */ |
|
33 | + protected $logoutPipes = ['DispatchEvent']; |
|
34 | + |
|
35 | + /** |
|
36 | + * @author Andrea Marco Sartori |
|
37 | + * @var array $registerPipes List of pipes for the register process. |
|
38 | + */ |
|
39 | + protected $registerPipes = ['DispatchEvent', 'Login', 'Notify', 'Hash']; |
|
40 | + |
|
41 | + /** |
|
42 | + * @author Andrea Marco Sartori |
|
43 | + * @var array $recoverPipes List of pipes for the password recover process. |
|
44 | + */ |
|
45 | + protected $recoverPipes = ['DispatchEvent', 'Notify', 'Store']; |
|
46 | + |
|
47 | + /** |
|
48 | + * @author Andrea Marco Sartori |
|
49 | + * @var array $resetPipes List of pipes for the password reset process. |
|
50 | + */ |
|
51 | + protected $resetPipes = ['DispatchEvent']; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Set the dependencies. |
|
55 | - * |
|
56 | - * @author Andrea Marco Sartori |
|
57 | - * @param Illuminate\Contracts\Bus\Dispatcher $bus |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function __construct(Dispatcher $bus) |
|
61 | - { |
|
62 | - $this->bus = $bus; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * Display the login page. |
|
67 | - * |
|
68 | - * @author Andrea Marco Sartori |
|
69 | - * @return Illuminate\Http\Response |
|
70 | - */ |
|
71 | - public function showLogin() |
|
72 | - { |
|
73 | - $login = config('_auth.login.view'); |
|
74 | - |
|
75 | - return view($login); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Log the user in. |
|
80 | - * |
|
81 | - * @author Andrea Marco Sartori |
|
82 | - * @return Illuminate\Http\RedirectResponse |
|
83 | - */ |
|
84 | - public function login(LoginRequest $request) |
|
85 | - { |
|
86 | - $this->bus->pipeThrough($this->pipesOf('login'))->dispatchFrom(LoginJob::class, $request); |
|
87 | - |
|
88 | - return redirect()->route(config('_auth.login.redirect')); |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Retrieve the pipes of a given process. |
|
93 | - * |
|
94 | - * @author Andrea Marco Sartori |
|
95 | - * @param string $process |
|
96 | - * @return array |
|
97 | - */ |
|
98 | - protected function pipesOf($process) |
|
99 | - { |
|
100 | - $Process = ucfirst($process); |
|
101 | - |
|
102 | - return array_map(function($pipe) use($Process) |
|
103 | - { |
|
104 | - return "Cerbero\Auth\Pipes\\{$Process}\\{$pipe}"; |
|
105 | - |
|
106 | - }, $this->{"{$process}Pipes"}); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Log the user out. |
|
111 | - * |
|
112 | - * @author Andrea Marco Sartori |
|
113 | - * @return Illuminate\Http\RedirectResponse |
|
114 | - */ |
|
115 | - public function logout() |
|
116 | - { |
|
117 | - $this->bus->pipeThrough($this->pipesOf('logout'))->dispatchNow(new LogoutJob); |
|
118 | - |
|
119 | - return redirect()->route(config('_auth.logout.redirect')); |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Display the registration page. |
|
124 | - * |
|
125 | - * @author Andrea Marco Sartori |
|
126 | - * @return Illuminate\Http\Response |
|
127 | - */ |
|
128 | - public function showRegister() |
|
129 | - { |
|
130 | - $register = config('_auth.register.view'); |
|
131 | - |
|
132 | - return view($register); |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Register the user. |
|
137 | - * |
|
138 | - * @author Andrea Marco Sartori |
|
139 | - * @return Illuminate\Http\RedirectResponse |
|
140 | - */ |
|
141 | - public function register(RegisterRequest $request) |
|
142 | - { |
|
143 | - $this->bus->pipeThrough($this->pipesOf('register'))->dispatchFrom(RegisterJob::class, $request); |
|
144 | - |
|
145 | - return redirect()->route(config('_auth.register.redirect'))->withSuccess(trans('auth::register.success')); |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Display the recover page. |
|
150 | - * |
|
151 | - * @author Andrea Marco Sartori |
|
152 | - * @return Illuminate\Http\Response |
|
153 | - */ |
|
154 | - public function showRecover() |
|
155 | - { |
|
156 | - $recover = config('_auth.recover.view'); |
|
157 | - |
|
158 | - return view($recover); |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * Remember the user password. |
|
163 | - * |
|
164 | - * @author Andrea Marco Sartori |
|
165 | - * @return Illuminate\Http\RedirectResponse |
|
166 | - */ |
|
167 | - public function recover(RecoverRequest $request) |
|
168 | - { |
|
169 | - $this->bus->pipeThrough($this->pipesOf('recover'))->dispatchFrom(RecoverJob::class, $request); |
|
170 | - |
|
171 | - return back()->withSuccess(trans('auth::recover.success')); |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * Display the reset page. |
|
176 | - * |
|
177 | - * @author Andrea Marco Sartori |
|
178 | - * @return Illuminate\Http\Response |
|
179 | - */ |
|
180 | - public function showReset($token) |
|
181 | - { |
|
182 | - $reset = config('_auth.reset.view'); |
|
183 | - |
|
184 | - return view($reset); |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * Reset the user password. |
|
189 | - * |
|
190 | - * @author Andrea Marco Sartori |
|
191 | - * @return Illuminate\Http\RedirectResponse |
|
192 | - */ |
|
193 | - public function reset(ResetRequest $request, $token) |
|
194 | - { |
|
195 | - $this->bus->pipeThrough($this->pipesOf('reset'))->dispatchFrom(ResetJob::class, $request, compact('token')); |
|
196 | - |
|
197 | - return redirect()->route('login.index')->withSuccess(trans('auth::reset.success')); |
|
198 | - } |
|
53 | + /** |
|
54 | + * Set the dependencies. |
|
55 | + * |
|
56 | + * @author Andrea Marco Sartori |
|
57 | + * @param Illuminate\Contracts\Bus\Dispatcher $bus |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function __construct(Dispatcher $bus) |
|
61 | + { |
|
62 | + $this->bus = $bus; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * Display the login page. |
|
67 | + * |
|
68 | + * @author Andrea Marco Sartori |
|
69 | + * @return Illuminate\Http\Response |
|
70 | + */ |
|
71 | + public function showLogin() |
|
72 | + { |
|
73 | + $login = config('_auth.login.view'); |
|
74 | + |
|
75 | + return view($login); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Log the user in. |
|
80 | + * |
|
81 | + * @author Andrea Marco Sartori |
|
82 | + * @return Illuminate\Http\RedirectResponse |
|
83 | + */ |
|
84 | + public function login(LoginRequest $request) |
|
85 | + { |
|
86 | + $this->bus->pipeThrough($this->pipesOf('login'))->dispatchFrom(LoginJob::class, $request); |
|
87 | + |
|
88 | + return redirect()->route(config('_auth.login.redirect')); |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Retrieve the pipes of a given process. |
|
93 | + * |
|
94 | + * @author Andrea Marco Sartori |
|
95 | + * @param string $process |
|
96 | + * @return array |
|
97 | + */ |
|
98 | + protected function pipesOf($process) |
|
99 | + { |
|
100 | + $Process = ucfirst($process); |
|
101 | + |
|
102 | + return array_map(function($pipe) use($Process) |
|
103 | + { |
|
104 | + return "Cerbero\Auth\Pipes\\{$Process}\\{$pipe}"; |
|
105 | + |
|
106 | + }, $this->{"{$process}Pipes"}); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Log the user out. |
|
111 | + * |
|
112 | + * @author Andrea Marco Sartori |
|
113 | + * @return Illuminate\Http\RedirectResponse |
|
114 | + */ |
|
115 | + public function logout() |
|
116 | + { |
|
117 | + $this->bus->pipeThrough($this->pipesOf('logout'))->dispatchNow(new LogoutJob); |
|
118 | + |
|
119 | + return redirect()->route(config('_auth.logout.redirect')); |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Display the registration page. |
|
124 | + * |
|
125 | + * @author Andrea Marco Sartori |
|
126 | + * @return Illuminate\Http\Response |
|
127 | + */ |
|
128 | + public function showRegister() |
|
129 | + { |
|
130 | + $register = config('_auth.register.view'); |
|
131 | + |
|
132 | + return view($register); |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Register the user. |
|
137 | + * |
|
138 | + * @author Andrea Marco Sartori |
|
139 | + * @return Illuminate\Http\RedirectResponse |
|
140 | + */ |
|
141 | + public function register(RegisterRequest $request) |
|
142 | + { |
|
143 | + $this->bus->pipeThrough($this->pipesOf('register'))->dispatchFrom(RegisterJob::class, $request); |
|
144 | + |
|
145 | + return redirect()->route(config('_auth.register.redirect'))->withSuccess(trans('auth::register.success')); |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Display the recover page. |
|
150 | + * |
|
151 | + * @author Andrea Marco Sartori |
|
152 | + * @return Illuminate\Http\Response |
|
153 | + */ |
|
154 | + public function showRecover() |
|
155 | + { |
|
156 | + $recover = config('_auth.recover.view'); |
|
157 | + |
|
158 | + return view($recover); |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * Remember the user password. |
|
163 | + * |
|
164 | + * @author Andrea Marco Sartori |
|
165 | + * @return Illuminate\Http\RedirectResponse |
|
166 | + */ |
|
167 | + public function recover(RecoverRequest $request) |
|
168 | + { |
|
169 | + $this->bus->pipeThrough($this->pipesOf('recover'))->dispatchFrom(RecoverJob::class, $request); |
|
170 | + |
|
171 | + return back()->withSuccess(trans('auth::recover.success')); |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * Display the reset page. |
|
176 | + * |
|
177 | + * @author Andrea Marco Sartori |
|
178 | + * @return Illuminate\Http\Response |
|
179 | + */ |
|
180 | + public function showReset($token) |
|
181 | + { |
|
182 | + $reset = config('_auth.reset.view'); |
|
183 | + |
|
184 | + return view($reset); |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * Reset the user password. |
|
189 | + * |
|
190 | + * @author Andrea Marco Sartori |
|
191 | + * @return Illuminate\Http\RedirectResponse |
|
192 | + */ |
|
193 | + public function reset(ResetRequest $request, $token) |
|
194 | + { |
|
195 | + $this->bus->pipeThrough($this->pipesOf('reset'))->dispatchFrom(ResetJob::class, $request, compact('token')); |
|
196 | + |
|
197 | + return redirect()->route('login.index')->withSuccess(trans('auth::reset.success')); |
|
198 | + } |
|
199 | 199 | |
200 | 200 | } |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class RegisterRequest extends FormRequest { |
6 | 6 | |
7 | - /** |
|
8 | - * Determine if the user is authorized to make this request. |
|
9 | - * |
|
10 | - * @return bool |
|
11 | - */ |
|
12 | - public function authorize() |
|
13 | - { |
|
14 | - return true; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Determine if the user is authorized to make this request. |
|
9 | + * |
|
10 | + * @return bool |
|
11 | + */ |
|
12 | + public function authorize() |
|
13 | + { |
|
14 | + return true; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Get the validation rules that apply to the request. |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function rules() |
|
23 | - { |
|
24 | - return config('_auth.register.rules'); |
|
25 | - } |
|
17 | + /** |
|
18 | + * Get the validation rules that apply to the request. |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function rules() |
|
23 | + { |
|
24 | + return config('_auth.register.rules'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class LoginRequest extends FormRequest { |
6 | 6 | |
7 | - /** |
|
8 | - * Determine if the user is authorized to make this request. |
|
9 | - * |
|
10 | - * @return bool |
|
11 | - */ |
|
12 | - public function authorize() |
|
13 | - { |
|
14 | - return true; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Determine if the user is authorized to make this request. |
|
9 | + * |
|
10 | + * @return bool |
|
11 | + */ |
|
12 | + public function authorize() |
|
13 | + { |
|
14 | + return true; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Get the validation rules that apply to the request. |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function rules() |
|
23 | - { |
|
24 | - return config('_auth.login.rules'); |
|
25 | - } |
|
17 | + /** |
|
18 | + * Get the validation rules that apply to the request. |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function rules() |
|
23 | + { |
|
24 | + return config('_auth.login.rules'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class ResetRequest extends FormRequest { |
6 | 6 | |
7 | - /** |
|
8 | - * Determine if the user is authorized to make this request. |
|
9 | - * |
|
10 | - * @return bool |
|
11 | - */ |
|
12 | - public function authorize() |
|
13 | - { |
|
14 | - return true; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Determine if the user is authorized to make this request. |
|
9 | + * |
|
10 | + * @return bool |
|
11 | + */ |
|
12 | + public function authorize() |
|
13 | + { |
|
14 | + return true; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Get the validation rules that apply to the request. |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function rules() |
|
23 | - { |
|
24 | - return config('_auth.reset.rules'); |
|
25 | - } |
|
17 | + /** |
|
18 | + * Get the validation rules that apply to the request. |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function rules() |
|
23 | + { |
|
24 | + return config('_auth.reset.rules'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class RecoverRequest extends FormRequest { |
6 | 6 | |
7 | - /** |
|
8 | - * Determine if the user is authorized to make this request. |
|
9 | - * |
|
10 | - * @return bool |
|
11 | - */ |
|
12 | - public function authorize() |
|
13 | - { |
|
14 | - return true; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Determine if the user is authorized to make this request. |
|
9 | + * |
|
10 | + * @return bool |
|
11 | + */ |
|
12 | + public function authorize() |
|
13 | + { |
|
14 | + return true; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Get the validation rules that apply to the request. |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function rules() |
|
23 | - { |
|
24 | - return config('_auth.recover.rules'); |
|
25 | - } |
|
17 | + /** |
|
18 | + * Get the validation rules that apply to the request. |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function rules() |
|
23 | + { |
|
24 | + return config('_auth.recover.rules'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -2,24 +2,24 @@ |
||
2 | 2 | |
3 | 3 | Route::group(['prefix' => config('_auth.routes_prefix')], function() |
4 | 4 | { |
5 | - Route::group(['middleware' => ['guest', 'honeypot']], function() |
|
6 | - { |
|
7 | - Route::get(config('_auth.login.route'), ['as' => 'login.index', 'uses' => config('_auth.controller') . '@showLogin']); |
|
8 | - Route::post(config('_auth.login.route'), ['as' => 'login.store', 'uses' => config('_auth.controller') . '@login']); |
|
5 | + Route::group(['middleware' => ['guest', 'honeypot']], function() |
|
6 | + { |
|
7 | + Route::get(config('_auth.login.route'), ['as' => 'login.index', 'uses' => config('_auth.controller') . '@showLogin']); |
|
8 | + Route::post(config('_auth.login.route'), ['as' => 'login.store', 'uses' => config('_auth.controller') . '@login']); |
|
9 | 9 | |
10 | - Route::get(config('_auth.register.route'), ['as' => 'register.index', 'uses' => config('_auth.controller') . '@showRegister']); |
|
11 | - Route::post(config('_auth.register.route'), ['as' => 'register.store', 'uses' => config('_auth.controller') . '@register']); |
|
10 | + Route::get(config('_auth.register.route'), ['as' => 'register.index', 'uses' => config('_auth.controller') . '@showRegister']); |
|
11 | + Route::post(config('_auth.register.route'), ['as' => 'register.store', 'uses' => config('_auth.controller') . '@register']); |
|
12 | 12 | |
13 | - Route::get(config('_auth.recover.route'), ['as' => 'recover.index', 'uses' => config('_auth.controller') . '@showRecover']); |
|
14 | - Route::post(config('_auth.recover.route'), ['as' => 'recover.store', 'uses' => config('_auth.controller') . '@recover']); |
|
13 | + Route::get(config('_auth.recover.route'), ['as' => 'recover.index', 'uses' => config('_auth.controller') . '@showRecover']); |
|
14 | + Route::post(config('_auth.recover.route'), ['as' => 'recover.store', 'uses' => config('_auth.controller') . '@recover']); |
|
15 | 15 | |
16 | - Route::get(config('_auth.reset.route') . '/{token}', ['as' => 'reset.index', 'uses' => config('_auth.controller') . '@showReset']); |
|
17 | - Route::post(config('_auth.reset.route') . '/{token}', ['as' => 'reset.store', 'uses' => config('_auth.controller') . '@reset']); |
|
18 | - }); |
|
16 | + Route::get(config('_auth.reset.route') . '/{token}', ['as' => 'reset.index', 'uses' => config('_auth.controller') . '@showReset']); |
|
17 | + Route::post(config('_auth.reset.route') . '/{token}', ['as' => 'reset.store', 'uses' => config('_auth.controller') . '@reset']); |
|
18 | + }); |
|
19 | 19 | |
20 | 20 | |
21 | - Route::group(['middleware' => 'auth'], function() |
|
22 | - { |
|
23 | - Route::get(config('_auth.logout.route'), ['as' => 'logout', 'uses' => config('_auth.controller') . '@logout']); |
|
24 | - }); |
|
21 | + Route::group(['middleware' => 'auth'], function() |
|
22 | + { |
|
23 | + Route::get(config('_auth.logout.route'), ['as' => 'logout', 'uses' => config('_auth.controller') . '@logout']); |
|
24 | + }); |
|
25 | 25 | }); |
@@ -13,38 +13,38 @@ |
||
13 | 13 | class Honeypot |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Handle an incoming request. |
|
18 | - * |
|
19 | - * @param \Illuminate\Http\Request $request |
|
20 | - * @param \Closure $next |
|
21 | - * @return mixed |
|
22 | - */ |
|
23 | - public function handle($request, Closure $next) |
|
24 | - { |
|
25 | - if(config('_auth.honeypot.enabled')) |
|
26 | - { |
|
27 | - $value = $request->input(config('_auth.honeypot.field')); |
|
28 | - |
|
29 | - $this->checkHoneypot($value); |
|
30 | - } |
|
31 | - |
|
32 | - return $next($request); |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * Throw an exception if the honeypot field is not empty. |
|
37 | - * |
|
38 | - * @author Andrea Marco Sartori |
|
39 | - * @param string $value |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected function checkHoneypot($value) |
|
43 | - { |
|
44 | - if($value !== null) |
|
45 | - { |
|
46 | - throw new DisplayException('auth::honeypot.error'); |
|
47 | - } |
|
48 | - } |
|
16 | + /** |
|
17 | + * Handle an incoming request. |
|
18 | + * |
|
19 | + * @param \Illuminate\Http\Request $request |
|
20 | + * @param \Closure $next |
|
21 | + * @return mixed |
|
22 | + */ |
|
23 | + public function handle($request, Closure $next) |
|
24 | + { |
|
25 | + if(config('_auth.honeypot.enabled')) |
|
26 | + { |
|
27 | + $value = $request->input(config('_auth.honeypot.field')); |
|
28 | + |
|
29 | + $this->checkHoneypot($value); |
|
30 | + } |
|
31 | + |
|
32 | + return $next($request); |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * Throw an exception if the honeypot field is not empty. |
|
37 | + * |
|
38 | + * @author Andrea Marco Sartori |
|
39 | + * @param string $value |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected function checkHoneypot($value) |
|
43 | + { |
|
44 | + if($value !== null) |
|
45 | + { |
|
46 | + throw new DisplayException('auth::honeypot.error'); |
|
47 | + } |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | */ |
8 | 8 | class DisplayException extends \Exception { |
9 | 9 | |
10 | - /** |
|
11 | - * Set the dependencies. |
|
12 | - * |
|
13 | - * @author Andrea Marco Sartori |
|
14 | - * @param string $message |
|
15 | - * @param array $parameters |
|
16 | - * @return void |
|
17 | - */ |
|
18 | - public function __construct($message, array $parameters = []) |
|
19 | - { |
|
20 | - $translation = trans($message, $parameters); |
|
10 | + /** |
|
11 | + * Set the dependencies. |
|
12 | + * |
|
13 | + * @author Andrea Marco Sartori |
|
14 | + * @param string $message |
|
15 | + * @param array $parameters |
|
16 | + * @return void |
|
17 | + */ |
|
18 | + public function __construct($message, array $parameters = []) |
|
19 | + { |
|
20 | + $translation = trans($message, $parameters); |
|
21 | 21 | |
22 | - parent::__construct($translation); |
|
23 | - } |
|
22 | + parent::__construct($translation); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | } |