aboutsummaryrefslogtreecommitdiff
path: root/views/login/index.php
blob: e538319a8ad2e912c099084f1335d19c9370d01f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
    $title = 'Login to your account';
    include '../meta.php';

    $status = null;
    $token = null;
    runController('login');
?>

<?php if ($status !== null): ?>
    <?php if ($status !== ""): ?>
        <p>
            Fail: <?= $status ?>
        </p>
    <?php else: ?>
        <p>
            Success!
        </p>
        <script type="text/javascript">
            sessionStorage.setItem("token", "<?= $token ?>");
            window.location.href = "/home/index.php";
        </script>
    <?php endif; ?>
<?php endif; ?>

<form action="./index.php" method="POST">
    <input type="text" name="username" placeholder="Username" minlength="1" pattern="[A-Za-z][A-Za-z_0-9]*">
    <input type="password" name="password" placeholder="Password" minlength="4">
    <input type="submit" value="Login">
</form>