1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Chuckbe\Chuckcms\Controllers\Auth; |
4
|
|
|
|
5
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
6
|
|
|
use Illuminate\Foundation\Auth\AuthenticatesUsers; |
|
|
|
|
7
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
8
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests; |
9
|
|
|
use Illuminate\Routing\Controller as BaseController; |
10
|
|
|
use Illuminate\Support\Facades\Auth; |
11
|
|
|
|
12
|
|
|
class LoginController extends BaseController |
13
|
|
|
{ |
14
|
|
|
/* |
15
|
|
|
|-------------------------------------------------------------------------- |
16
|
|
|
| Login Controller |
17
|
|
|
|-------------------------------------------------------------------------- |
18
|
|
|
| |
19
|
|
|
| This controller handles authenticating users for the application and |
20
|
|
|
| redirecting them to your home screen. The controller uses a trait |
21
|
|
|
| to conveniently provide its functionality to your applications. |
22
|
|
|
| |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
use AuthorizesRequests; |
26
|
|
|
use DispatchesJobs; |
27
|
|
|
use ValidatesRequests; |
28
|
|
|
use AuthenticatesUsers; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Where to redirect users after login. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
protected $redirectTo = '/dashboard'; |
36
|
|
|
|
37
|
|
|
protected function redirectTo() |
38
|
|
|
{ |
39
|
|
|
return '/'.Auth::user()->roles()->first()->redirect; |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Create a new controller instance. |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
public function __construct() |
48
|
|
|
{ |
49
|
|
|
$this->middleware('guest')->except('logout'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function showLoginForm() |
53
|
|
|
{ |
54
|
|
|
return view('chuckcms::auth.login'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
protected function validateLogin(\Illuminate\Http\Request $request) |
58
|
|
|
{ |
59
|
|
|
$this->validate($request, [ |
60
|
|
|
$this->username() => 'required|exists:users,'.$this->username().',active,1', |
61
|
|
|
'password' => 'required', |
62
|
|
|
], [ |
63
|
|
|
$this->username().'.exists' => 'The selected email is invalid or the account is not active.', |
64
|
|
|
]); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths