]> git.localhorst.tv Git - alttp.git/blob - app/Http/Controllers/Auth/ConfirmablePasswordController.php
add discord auth
[alttp.git] / app / Http / Controllers / Auth / ConfirmablePasswordController.php
1 <?php
2
3 namespace App\Http\Controllers\Auth;
4
5 use App\Http\Controllers\Controller;
6 use App\Providers\RouteServiceProvider;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth;
9 use Illuminate\Validation\ValidationException;
10
11 class ConfirmablePasswordController extends Controller
12 {
13     /**
14      * Show the confirm password view.
15      *
16      * @return \Illuminate\View\View
17      */
18     public function show()
19     {
20         return view('auth.confirm-password');
21     }
22
23     /**
24      * Confirm the user's password.
25      *
26      * @param  \Illuminate\Http\Request  $request
27      * @return mixed
28      */
29     public function store(Request $request)
30     {
31         if (! Auth::guard('web')->validate([
32             'email' => $request->user()->email,
33             'password' => $request->password,
34         ])) {
35             throw ValidationException::withMessages([
36                 'password' => __('auth.password'),
37             ]);
38         }
39
40         $request->session()->put('auth.password_confirmed_at', time());
41
42         return redirect()->intended(RouteServiceProvider::HOME);
43     }
44 }