diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php new file mode 100644 index 0000000..2d7d726 --- /dev/null +++ b/app/Http/Middleware/Authenticate.php @@ -0,0 +1,26 @@ +expectsJson()) { + // Cek guard admin dulu + if ($request->is('admin/*')) { + return route('admin.login'); + } + + // Default kalau bukan admin (misalnya guru/siswa) + return route('login'); + } + + return null; + } +} diff --git a/database/migrations/2025_10_27_072633_add_remember_token_to_admins_table.php b/database/migrations/2025_10_27_072633_add_remember_token_to_admins_table.php new file mode 100644 index 0000000..b4dd2ee --- /dev/null +++ b/database/migrations/2025_10_27_072633_add_remember_token_to_admins_table.php @@ -0,0 +1,21 @@ +rememberToken()->after('password'); + }); + } + + public function down(): void + { + Schema::table('admins', function (Blueprint $table) { + $table->dropColumn('remember_token'); + }); + } +}; diff --git a/public/css/login-admin.css b/public/css/login-admin.css index b4ae94a..47c5cda 100644 --- a/public/css/login-admin.css +++ b/public/css/login-admin.css @@ -174,3 +174,66 @@ @media (max-width: 600px) { font-size: 18px; } } + +/* ==================== */ +/* TOAST & REMEMBER CSS */ +/* ==================== */ + +/* Toast Notifikasi Error */ +.toast-error { + position: relative; + margin-bottom: 1rem; + background-color: #e62727; /* soft red pastel */ + color: #fff; + padding: 10px 14px; + border-radius: 10px; + text-align: center; + animation: fadeInOut 3.5s ease forwards; + font-size: 15px; + font-family: "Istok Web", sans-serif; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); +} + +@keyframes fadeInOut { + 0% { + opacity: 0; + transform: translateY(-10px); + } + 10% { + opacity: 1; + transform: translateY(0); + } + 90% { + opacity: 1; + transform: translateY(0); + } + 100% { + opacity: 0; + transform: translateY(-10px); + } +} + +/* Remember Me Styling */ +.remember-wrapper { + margin-top: 0.3rem; + display: flex; + align-items: center; + justify-content: center; /* <— ubah dari flex-start jadi center */ + width: 100%; +} + +.remember-label { + font-size: 15px; + color: #333; + font-family: "Istok Web", sans-serif; + cursor: pointer; + display: flex; + align-items: center; + gap: 6px; + user-select: none; +} + +.remember-label input { + transform: scale(1.1); + accent-color: #2196f3; /* biru lembut biar nyatu */ +} diff --git a/resources/views/auth/login-admin.blade.php b/resources/views/auth/login-admin.blade.php index 2d21273..cc6fa56 100644 --- a/resources/views/auth/login-admin.blade.php +++ b/resources/views/auth/login-admin.blade.php @@ -9,6 +9,13 @@

SIGN IN ADMIN

+ {{-- Toast Notifikasi Error --}} + @if ($errors->any()) +
+ {{ $errors->first() }} +
+ @endif +
@csrf
@@ -16,7 +23,8 @@ {{-- Username --}}
Username icon - +
{{-- Password --}} @@ -30,6 +38,14 @@
+ {{-- Remember Me --}} +
+ +
+
@@ -54,6 +70,12 @@ : "{{ asset('icons/hide.svg') }}"; eyeIcon.alt = isVisible ? "Show password" : "Hide password"; }); + + // Auto hide toast notification + const toast = document.getElementById('toast-error'); + if (toast) { + setTimeout(() => toast.remove(), 4000); + } }); @endsection