<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/login.css"/>
    <title>Login</title>
</head>

<body>
    <header>
        <%- include('partials/navbar.ejs') %>
    </header>
    <div class="page-wrapper">
    <% if (req.session && req.session.registrationSuccess) { %>
        <div class="alert alert-success" role="alert">
            <%= req.session.registrationSuccess %>
        </div>
        <% delete req.session.registrationSuccess; %> 
    <% } %>
    
    <div class="container mt-5">
        <div class="row justify-content-center">
            <div class="col-md-6">
                <div class="card">
                    <div class="card-header text-center">
                        <h4>Login</h4>
                    </div>
                    <div class="card-body">
                        <form action="/login" method="post">
                            <div class="form-group">
                                <label for="login">Username or Email:</label>
                                <input type="text" name="login" id="login" class="form-control" required>
                            </div>
                            <div class="form-group">
                                <label for="password">Password:</label>
                                <input type="password" name="password" id="password" class="form-control" required>
                            </div>
                            <div class="form-group text-center">
                                <button type="submit" class="btn btn-primary">Login</button>
                            </div>
                        </form>
                        <p class="text-center">Don't have an account? <a href="/register">Register here</a>.</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer>
        <%- include('partials/footer.ejs') %>
    </footer>
</div>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>

</html>
