mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
Add Google OAuth admin login; fix header comment; both auth methods active
This commit is contained in:
+26
-1
@@ -9,7 +9,11 @@ if (AdminAuth::isLoggedIn()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$error = '';
|
||||
$googleEnabled = defined('GOOGLE_CLIENT_ID') && GOOGLE_CLIENT_ID;
|
||||
|
||||
$error = $_SESSION['admin_login_error'] ?? '';
|
||||
unset($_SESSION['admin_login_error']);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$email = trim($_POST['email'] ?? '');
|
||||
$password = trim($_POST['password'] ?? '');
|
||||
@@ -41,6 +45,12 @@ input{width:100%;background:#111;border:1.5px solid #2a2a2a;border-radius:8px;pa
|
||||
input:focus{border-color:#FF5E1A}
|
||||
.btn{width:100%;padding:14px;border:none;border-radius:8px;background:#FF5E1A;color:#fff;font-family:Inter,sans-serif;font-weight:600;font-size:15px;cursor:pointer;transition:background .2s;margin-top:4px}
|
||||
.btn:hover{background:#e54d0f}
|
||||
.btn-google{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;padding:13px;border:1.5px solid #333;border-radius:8px;background:#111;color:#e0e0e0;font-family:Inter,sans-serif;font-weight:500;font-size:15px;cursor:pointer;text-decoration:none;transition:border-color .2s,background .2s}
|
||||
.btn-google:hover{border-color:#555;background:#1a1a1a}
|
||||
.btn-google svg{width:20px;height:20px;flex-shrink:0}
|
||||
.divider{display:flex;align-items:center;gap:12px;margin:22px 0}
|
||||
.divider::before,.divider::after{content:'';flex:1;height:1px;background:#2a2a2a}
|
||||
.divider span{font-size:12px;color:#444}
|
||||
.error{background:rgba(220,38,38,.1);border:1px solid rgba(220,38,38,.3);color:#f87171;padding:12px 15px;border-radius:8px;font-size:14px;margin-bottom:20px;display:flex;align-items:center;gap:8px}
|
||||
.back{display:block;text-align:center;margin-top:20px;color:#555;font-size:13px;text-decoration:none;transition:color .2s}
|
||||
.back:hover{color:#FF5E1A}
|
||||
@@ -52,9 +62,24 @@ input:focus{border-color:#FF5E1A}
|
||||
<h1>☕ Tom's Java Jive</h1>
|
||||
<p>Admin Panel</p>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="error">⚠ <?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($googleEnabled): ?>
|
||||
<a href="/admin/auth/google/login.php" class="btn-google">
|
||||
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v8.51h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.14z"/>
|
||||
<path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"/>
|
||||
<path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"/>
|
||||
<path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"/>
|
||||
</svg>
|
||||
Sign in with Google
|
||||
</a>
|
||||
<div class="divider"><span>or sign in with email</span></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST">
|
||||
<label>Email Address</label>
|
||||
<input type="email" name="email" placeholder="admin@tomsjavajive.com" required autocomplete="email">
|
||||
|
||||
Reference in New Issue
Block a user