]> git.localhorst.tv Git - alttp.git/blob - app/Http/Controllers/Auth/AuthenticatedSessionController.php
add discord auth
[alttp.git] / app / Http / Controllers / Auth / AuthenticatedSessionController.php
1 <?php
2
3 namespace App\Http\Controllers\Auth;
4
5 use App\Http\Controllers\Controller;
6 use App\Http\Requests\Auth\LoginRequest;
7 use App\Providers\RouteServiceProvider;
8 use Illuminate\Http\Request;
9 use Illuminate\Support\Facades\Auth;
10
11 class AuthenticatedSessionController extends Controller
12 {
13     /**
14      * Display the login view.
15      *
16      * @return \Illuminate\View\View
17      */
18     public function create()
19     {
20         return view('auth.login');
21     }
22
23     /**
24      * Handle an incoming authentication request.
25      *
26      * @param  \App\Http\Requests\Auth\LoginRequest  $request
27      * @return \Illuminate\Http\RedirectResponse
28      */
29     public function store(LoginRequest $request)
30     {
31         $request->authenticate();
32
33         $request->session()->regenerate();
34
35         return redirect()->intended(RouteServiceProvider::HOME);
36     }
37
38     /**
39      * Destroy an authenticated session.
40      *
41      * @param  \Illuminate\Http\Request  $request
42      * @return \Illuminate\Http\RedirectResponse
43      */
44     public function destroy(Request $request)
45     {
46         Auth::guard('web')->logout();
47
48         $request->session()->invalidate();
49
50         $request->session()->regenerateToken();
51
52         return redirect('/');
53     }
54 }