- initial
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once __DIR__.'/includes/boot.php';
|
||||
if (authed()) go('/index.php');
|
||||
$pageTitle = 'Login — Keyser WV';
|
||||
$next = gs('next') ?: '/index.php';
|
||||
$err = '';
|
||||
if (isPost()) {
|
||||
csrfCheck();
|
||||
$un = ps('username'); $pw = ps('password');
|
||||
$u = qone("SELECT * FROM users WHERE (username=? OR email=?) AND is_active=1", [$un, $un]);
|
||||
if ($u && password_verify($pw, $u['password'])) {
|
||||
loginUser($u);
|
||||
flash('Welcome back, '.e($u['username']).'!', 'success');
|
||||
go($next);
|
||||
} else {
|
||||
$err = 'Invalid username or password.';
|
||||
}
|
||||
}
|
||||
include __DIR__.'/includes/header.php';
|
||||
?>
|
||||
<div class="form-box">
|
||||
<h1 class="form-title">Sign In</h1>
|
||||
<p class="form-sub">Welcome back to Discover Keyser WV</p>
|
||||
<?php if ($err): ?><div class="err-box"><?=e($err)?></div><?php endif; ?>
|
||||
<form method="POST">
|
||||
<?=csrfField()?>
|
||||
<div class="fg"><label class="flabel">USERNAME OR EMAIL</label><input type="text" name="username" class="finput" autocomplete="username" required autofocus></div>
|
||||
<div class="fg"><label class="flabel">PASSWORD</label><input type="password" name="password" class="finput" autocomplete="current-password" required></div>
|
||||
<button type="submit" class="btn btn-primary btn-block" style="margin-top:.5rem">Sign In</button>
|
||||
</form>
|
||||
<?php if (setting('registration_enabled','1') === '1'): ?>
|
||||
<p style="text-align:center;margin-top:1.25rem;font-size:.88rem;color:var(--text-m)">Don't have an account? <a href="/register.php">Sign up free</a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php include __DIR__.'/includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user