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