modified: app/Http/Controllers/AuthController.php
modified: app/Http/Controllers/SmartController.php new file: resources/views/smart/dashboard.blade.php modified: resources/views/smart/login.blade.php
This commit is contained in:
parent
1930cbbd73
commit
28f62d3005
|
@ -12,14 +12,18 @@ class AuthController extends Controller
|
|||
{
|
||||
try {
|
||||
$credits = $request->validate([
|
||||
"email" => "required|email",
|
||||
"password" => "required"
|
||||
"email" => "required|email",
|
||||
"password" => "required"
|
||||
]);
|
||||
|
||||
if (Auth::attempt(["email" => $credits["email"], "password" => $credits["password"]])) {
|
||||
$user = Auth::user();
|
||||
$user = Auth::user();
|
||||
|
||||
return response()->json(["account" => $user->name], 200);
|
||||
return response()->json([
|
||||
"account" => $user->name,
|
||||
"redirect" => "3000",
|
||||
"message" => "Login successful. Redirecting in 3 seconds..."
|
||||
], 200);
|
||||
}
|
||||
|
||||
return response()->json(["error" => "Invalid email or password."], 401);
|
||||
|
|
|
@ -10,4 +10,9 @@ class SmartController extends Controller
|
|||
{
|
||||
return view('smart.login');
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
return view('smart.dashboard');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="bg-slate-900">
|
||||
<head>
|
||||
@vite(['resources/css/app.css','resources/js/app.js'])
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NCORE - Dashboard</title>
|
||||
<style>
|
||||
@media (max-width: 768px) {
|
||||
.col-1 {
|
||||
width: 50px;
|
||||
}
|
||||
.col-2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
@media (min-width: 769px) {
|
||||
.col-1 {
|
||||
width: 92px;
|
||||
}
|
||||
.col-2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
|
@ -2,7 +2,26 @@
|
|||
<html lang="en" class="bg-slate-900">
|
||||
<head>
|
||||
@vite(['resources/css/app.css','resources/js/app.js'])
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NCORE - Authentication</title>
|
||||
<style>
|
||||
@media (max-width: 768px) {
|
||||
.col-1 {
|
||||
width: 50px;
|
||||
}
|
||||
.col-2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
@media (min-width: 769px) {
|
||||
.col-1 {
|
||||
width: 92px;
|
||||
}
|
||||
.col-2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -60,7 +79,10 @@
|
|||
Swal.fire({
|
||||
title: "Success!",
|
||||
text: "You are Logged in as " + response.data.account,
|
||||
icon: "success"
|
||||
icon: "success",
|
||||
timer: response.data.redirect
|
||||
}).then(() => {
|
||||
window.location.href = "{{ route('dashboard') }}";
|
||||
});
|
||||
console.log(response);
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue