First Commit
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (is_logged_in()) {
|
||||
header("Location: index.php?page=home");
|
||||
exit;
|
||||
}
|
||||
|
||||
$error_msg = "";
|
||||
$success_msg = "";
|
||||
|
||||
if (isset($_GET['installed'])) {
|
||||
$success_msg = __('login_installed_success');
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = $_POST['username'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
$res = login_user($username, $password);
|
||||
if ($res['success']) {
|
||||
header("Location: index.php?page=home");
|
||||
exit;
|
||||
} else {
|
||||
$error_msg = $res['message'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<main class="main-content">
|
||||
<div style="max-width: 420px; margin: 3rem auto;">
|
||||
<div class="card" style="padding: 2.25rem;">
|
||||
<div style="text-align: center; margin-bottom: 2rem;">
|
||||
<span style="font-size: 3rem;">📝</span>
|
||||
<h2 style="font-size: 1.6rem; font-weight: 700; color: #fff; margin-top: 0.5rem;"><?= __('login_title') ?></h2>
|
||||
<p style="color: #94a3b8; font-size: 0.9rem; margin-top: 0.25rem;"><?= __('login_subtitle') ?></p>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($success_msg)): ?>
|
||||
<div class="alert alert-success">
|
||||
✅ <?= htmlspecialchars($success_msg) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($error_msg)): ?>
|
||||
<div class="alert alert-danger">
|
||||
⚠️ <?= htmlspecialchars($error_msg) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="index.php?page=login" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="username"><?= __('label_username') ?></label>
|
||||
<input type="text" name="username" id="username" class="form-control" required placeholder="<?= __('placeholder_username') ?>" autofocus value="<?= htmlspecialchars($_POST['username'] ?? '') ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password"><?= __('label_password') ?></label>
|
||||
<input type="password" name="password" id="password" class="form-control" required placeholder="<?= __('placeholder_password') ?>">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary" style="width: 100%; justify-content: center; margin-top: 1rem; padding: 0.8rem;">
|
||||
<?= __('btn_submit_login') ?>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div style="margin-top: 1.5rem; text-align: center; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.82rem; color: #64748b;">
|
||||
<?= __('login_hint_footer') ?>:<br>
|
||||
<strong style="color: #94a3b8;"><?= __('label_username') ?>:</strong> admin | <strong style="color: #94a3b8;"><?= __('label_password') ?>:</strong> admin123
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
Reference in New Issue
Block a user