33 lines
836 B
PHP
33 lines
836 B
PHP
<?php
|
|
|
|
$errors = [];
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$res = User::AuthWithPassword($_POST['password'] ?? '');
|
|
if ($res['result']) {
|
|
header('Location: '.URL::link('account/profile'));
|
|
exit;
|
|
} else {
|
|
$errors[] = $res['message'];
|
|
}
|
|
}
|
|
|
|
?><!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Login</title>
|
|
</head>
|
|
<body>
|
|
<h1>Login</h1>
|
|
<?php if ($errors): ?>
|
|
<div style="color: red"><?php echo htmlspecialchars(implode(', ', $errors)); ?></div>
|
|
<?php endif; ?>
|
|
<form method="post">
|
|
<label>Email: <input type="email" name="email" required></label><br>
|
|
<label>Password: <input type="password" name="password" required></label><br>
|
|
<button type="submit">Login</button>
|
|
</form>
|
|
<p><a href="<?= URL::link('account/register') ?>">Register</a></p>
|
|
</body>
|
|
</html>
|