@@ -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 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function handle($request, Closure $next) |
24 | 24 | { |
25 | - if(config('_auth.honeypot.enabled')) |
|
25 | + if (config('_auth.honeypot.enabled')) |
|
26 | 26 | { |
27 | 27 | $value = $request->input(config('_auth.honeypot.field')); |
28 | 28 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function checkHoneypot($value) |
43 | 43 | { |
44 | - if($value !== null) |
|
44 | + if ($value !== null) |
|
45 | 45 | { |
46 | 46 | throw new DisplayException('auth::honeypot.error'); |
47 | 47 | } |
@@ -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 | } |
@@ -9,30 +9,30 @@ |
||
9 | 9 | */ |
10 | 10 | trait DisplaysExceptions { |
11 | 11 | |
12 | - /** |
|
13 | - * @author Andrea Marco Sartori |
|
14 | - * @var array $display Exceptions to display to the user. |
|
15 | - */ |
|
16 | - protected $display = array(); |
|
12 | + /** |
|
13 | + * @author Andrea Marco Sartori |
|
14 | + * @var array $display Exceptions to display to the user. |
|
15 | + */ |
|
16 | + protected $display = array(); |
|
17 | 17 | |
18 | - /** |
|
19 | - * Determine how to render the DisplayException. |
|
20 | - * |
|
21 | - * @author Andrea Marco Sartori |
|
22 | - * @param \Exception $e |
|
23 | - * @return Illuminate\Http\RedirectResponse |
|
24 | - */ |
|
25 | - protected function displayExceptions(Exception $e) |
|
26 | - { |
|
27 | - $this->display[] = 'Cerbero\Auth\Exceptions\DisplayException'; |
|
18 | + /** |
|
19 | + * Determine how to render the DisplayException. |
|
20 | + * |
|
21 | + * @author Andrea Marco Sartori |
|
22 | + * @param \Exception $e |
|
23 | + * @return Illuminate\Http\RedirectResponse |
|
24 | + */ |
|
25 | + protected function displayExceptions(Exception $e) |
|
26 | + { |
|
27 | + $this->display[] = 'Cerbero\Auth\Exceptions\DisplayException'; |
|
28 | 28 | |
29 | - foreach ($this->display as $exception) |
|
30 | - { |
|
31 | - if($e instanceof $exception) |
|
32 | - { |
|
33 | - return back()->withInput()->withError($e->getMessage()); |
|
34 | - } |
|
35 | - } |
|
36 | - } |
|
29 | + foreach ($this->display as $exception) |
|
30 | + { |
|
31 | + if($e instanceof $exception) |
|
32 | + { |
|
33 | + return back()->withInput()->withError($e->getMessage()); |
|
34 | + } |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | foreach ($this->display as $exception) |
30 | 30 | { |
31 | - if($e instanceof $exception) |
|
31 | + if ($e instanceof $exception) |
|
32 | 32 | { |
33 | 33 | return back()->withInput()->withError($e->getMessage()); |
34 | 34 | } |
@@ -7,41 +7,41 @@ |
||
7 | 7 | */ |
8 | 8 | interface UserRepositoryInterface { |
9 | 9 | |
10 | - /** |
|
11 | - * Register a new user. |
|
12 | - * |
|
13 | - * @author Andrea Marco Sartori |
|
14 | - * @param array $attributes |
|
15 | - * @return mixed |
|
16 | - */ |
|
17 | - public function register(array $attributes); |
|
10 | + /** |
|
11 | + * Register a new user. |
|
12 | + * |
|
13 | + * @author Andrea Marco Sartori |
|
14 | + * @param array $attributes |
|
15 | + * @return mixed |
|
16 | + */ |
|
17 | + public function register(array $attributes); |
|
18 | 18 | |
19 | - /** |
|
20 | - * Assign a token to reset the password of the user with the given email. |
|
21 | - * |
|
22 | - * @author Andrea Marco Sartori |
|
23 | - * @param string $token |
|
24 | - * @param string $email |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function assignResetToken($token, $email); |
|
19 | + /** |
|
20 | + * Assign a token to reset the password of the user with the given email. |
|
21 | + * |
|
22 | + * @author Andrea Marco Sartori |
|
23 | + * @param string $token |
|
24 | + * @param string $email |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function assignResetToken($token, $email); |
|
28 | 28 | |
29 | - /** |
|
30 | - * Retrieve the user with the given reset token. |
|
31 | - * |
|
32 | - * @author Andrea Marco Sartori |
|
33 | - * @param string $token |
|
34 | - * @return mixed|null |
|
35 | - */ |
|
36 | - public function findByResetToken($token); |
|
29 | + /** |
|
30 | + * Retrieve the user with the given reset token. |
|
31 | + * |
|
32 | + * @author Andrea Marco Sartori |
|
33 | + * @param string $token |
|
34 | + * @return mixed|null |
|
35 | + */ |
|
36 | + public function findByResetToken($token); |
|
37 | 37 | |
38 | - /** |
|
39 | - * Reset the password of the given user. |
|
40 | - * |
|
41 | - * @author Andrea Marco Sartori |
|
42 | - * @param mixed $user |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function resetPassword($user, $password); |
|
38 | + /** |
|
39 | + * Reset the password of the given user. |
|
40 | + * |
|
41 | + * @author Andrea Marco Sartori |
|
42 | + * @param mixed $user |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function resetPassword($user, $password); |
|
46 | 46 | |
47 | 47 | } |
@@ -10,60 +10,60 @@ |
||
10 | 10 | interface ThrottlerInterface |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * Set univocal source where attempts come from. |
|
15 | - * |
|
16 | - * @author Andrea Marco Sartori |
|
17 | - * @return boolean |
|
18 | - */ |
|
19 | - public function setSource($source); |
|
13 | + /** |
|
14 | + * Set univocal source where attempts come from. |
|
15 | + * |
|
16 | + * @author Andrea Marco Sartori |
|
17 | + * @return boolean |
|
18 | + */ |
|
19 | + public function setSource($source); |
|
20 | 20 | |
21 | - /** |
|
22 | - * Determine whether the user has been locked out. |
|
23 | - * |
|
24 | - * @author Andrea Marco Sartori |
|
25 | - * @return boolean |
|
26 | - */ |
|
27 | - public function lockedOut(); |
|
21 | + /** |
|
22 | + * Determine whether the user has been locked out. |
|
23 | + * |
|
24 | + * @author Andrea Marco Sartori |
|
25 | + * @return boolean |
|
26 | + */ |
|
27 | + public function lockedOut(); |
|
28 | 28 | |
29 | - /** |
|
30 | - * Retrieve the number of remaining seconds before the next attempt. |
|
31 | - * |
|
32 | - * @author Andrea Marco Sartori |
|
33 | - * @return integer |
|
34 | - */ |
|
35 | - public function getRemainingSeconds(); |
|
29 | + /** |
|
30 | + * Retrieve the number of remaining seconds before the next attempt. |
|
31 | + * |
|
32 | + * @author Andrea Marco Sartori |
|
33 | + * @return integer |
|
34 | + */ |
|
35 | + public function getRemainingSeconds(); |
|
36 | 36 | |
37 | - /** |
|
38 | - * Increment the number of failed attempts. |
|
39 | - * |
|
40 | - * @author Andrea Marco Sartori |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function incrementAttempts(); |
|
37 | + /** |
|
38 | + * Increment the number of failed attempts. |
|
39 | + * |
|
40 | + * @author Andrea Marco Sartori |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function incrementAttempts(); |
|
44 | 44 | |
45 | - /** |
|
46 | - * Determine whether a user has performed too many attempts. |
|
47 | - * |
|
48 | - * @author Andrea Marco Sartori |
|
49 | - * @return boolean |
|
50 | - */ |
|
51 | - public function tooManyAttempts(); |
|
45 | + /** |
|
46 | + * Determine whether a user has performed too many attempts. |
|
47 | + * |
|
48 | + * @author Andrea Marco Sartori |
|
49 | + * @return boolean |
|
50 | + */ |
|
51 | + public function tooManyAttempts(); |
|
52 | 52 | |
53 | - /** |
|
54 | - * Lock a user out. |
|
55 | - * |
|
56 | - * @author Andrea Marco Sartori |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function lockOut(); |
|
53 | + /** |
|
54 | + * Lock a user out. |
|
55 | + * |
|
56 | + * @author Andrea Marco Sartori |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function lockOut(); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Reset the attempts counter. |
|
63 | - * |
|
64 | - * @author Andrea Marco Sartori |
|
65 | - * @return void |
|
66 | - */ |
|
67 | - public function resetAttempts(); |
|
61 | + /** |
|
62 | + * Reset the attempts counter. |
|
63 | + * |
|
64 | + * @author Andrea Marco Sartori |
|
65 | + * @return void |
|
66 | + */ |
|
67 | + public function resetAttempts(); |
|
68 | 68 | |
69 | 69 | } |