ForRo/app/Http/Controllers/AuthController.php
Ro 7151314122
Added About, Listings, Location pages
Added additional pages About, Listings, and Location as well as
implementing the corresponding functionality for those pages to be able
to pull the data they need from the DB.

Also continued layout clean up and adjusted some gloabal font sizing
settings
2023-08-18 14:34:53 -07:00

49 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class AuthController extends Controller
{
public function showLogin(Request $request)
{
//$token = $request->session()->token();
//$token = csrf_token();
return view('back.login', ["title" => "The Den"]);
}
public function memberAuth(Request $request): Response
{
$token = csrf_token();
$credentials = $request->validate([
'handle' => ['required'],
'password' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('den');
}
return back()->withErrors([
'error' => 'Nope. Check your crendtials, champ',
]);
}
public function leave(Request $request): Response
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->intended('login');
}
}