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:
Jan_Hill 2024-12-20 02:43:06 +01:00
parent 1930cbbd73
commit 28f62d3005
4 changed files with 61 additions and 5 deletions

View File

@ -19,7 +19,11 @@ class AuthController extends Controller
if (Auth::attempt(["email" => $credits["email"], "password" => $credits["password"]])) {
$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);

View File

@ -10,4 +10,9 @@ class SmartController extends Controller
{
return view('smart.login');
}
public function dashboard()
{
return view('smart.dashboard');
}
}

View File

@ -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>

View File

@ -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);
})