1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace KielD01\LaravelMaterialDashboardPro\Http\Controllers; |
||
6 | |||
7 | use Illuminate\Http\RedirectResponse; |
||
8 | use Illuminate\Http\Request; |
||
9 | use Illuminate\Routing\Controller; |
||
10 | use Illuminate\Support\Str; |
||
11 | |||
12 | class TestAuthController extends Controller |
||
13 | { |
||
14 | public function login(): string |
||
15 | { |
||
16 | return view('mdp::pages.user.login')->render(); |
||
17 | } |
||
18 | |||
19 | public function auth(Request $request): RedirectResponse |
||
20 | { |
||
21 | $credentials = [ |
||
22 | 'email' => $request->post('email'), |
||
23 | 'password' => $request->post('password') |
||
24 | ]; |
||
25 | |||
26 | $emailCheck = Str::is('[email protected]', $credentials['email']); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
27 | $passwordCheck = Str::is('adminTest!123', $credentials['password']); |
||
28 | $checksPassed = $emailCheck && $passwordCheck; |
||
29 | |||
30 | if ($checksPassed) { |
||
31 | return redirect(route('kield01.mdp.dashboard.index')); |
||
32 | } |
||
33 | |||
34 | return redirect() |
||
35 | ->back() |
||
36 | ->with($credentials); |
||
37 | } |
||
38 | |||
39 | public function register(): string |
||
40 | { |
||
41 | return view('mdp::pages.user.register')->render(); |
||
42 | } |
||
43 | } |
||
44 |