3.5 KiB · text History 263b40b
{% extends "root.html" %}

{% block content %}
<div class="hero min-h-[70vh]">
    <div class="hero-content flex-col lg:flex-row-reverse">
        <div class="text-center lg:text-left">
            <h1 class="text-5xl font-bold">Log in</h1>
            <p class="py-6">Welcome back to {{ app_name }}.</p>
            {% if signed_out %}
            <div class="alert">
                <i class="fas fa-door-open"></i>
                <span>You're signed out of {{ app_name }}.
                {% for l in logout_links %}
                    <a href="{{ l.url }}" class="link link-primary" data-oidc-logout="{{ l.id }}">Also sign out of {{ l.label|replace("Sign in with ", "") }}</a>{% if not loop.last %} · {% endif %}
                {% endfor %}
                </span>
            </div>
            {% endif %}
            {% if reset %}
            <div class="alert alert-success mt-2" role="status" data-reset-done><i class="fas fa-circle-check"></i><span>Your password has been changed. Log in with the new one.</span></div>
            {% endif %}
            {% if error %}
            <div class="alert alert-error mt-2"><i class="fas fa-circle-exclamation"></i><span>{{ error }}</span></div>
            {% endif %}
        </div>
        <div class="card shrink-0 w-full max-w-sm shadow-2xl bg-base-100">
            {% if providers %}
            <div class="card-body pb-0">
                {# Plain links, not boosted: the OIDC flow needs a full-page navigation. #}
                {% for p in providers %}
                <a class="btn btn-secondary w-full" data-oidc-provider="{{ p.id }}" hx-boost="false"
                   href="{{ p.login_url }}{% if next %}?next={{ next|urlencode }}{% endif %}">
                    <i class="fas fa-key mr-2"></i> {{ p.label }}
                </a>
                {% endfor %}
                {% if password_login %}<div class="divider">or</div>{% endif %}
            </div>
            {% endif %}
            {% if password_login %}
            <form class="card-body" action="/auth/login" method="post" hx-boost="false">
                <div class="form-control">
                    <label class="label"><span class="label-text">Username</span></label>
                    <input type="text" name="username" placeholder="Username" class="input input-bordered" required autofocus/>
                </div>
                <div class="form-control">
                    <label class="label"><span class="label-text">Password</span></label>
                    <input type="password" name="password" placeholder="Password" class="input input-bordered" required/>
                    <label class="label"><a href="/password/forgot" class="label-text-alt link link-hover" data-forgot-password>Forgot password?</a></label>
                </div>
                <div class="form-control mt-6">
                    <button class="btn btn-primary" type="submit"><i class="fas fa-sign-in-alt mr-2"></i> Log in</button>
                </div>
                <div class="text-center mt-4">
                    <p class="text-sm">
                        {% if registration_open %}
                          New here? <a href="/register" class="link link-primary">Register</a>
                        {% else %}
                          <span class="opacity-70">Registration is invite-only — ask an existing member for an invite link.</span>
                        {% endif %}
                    </p>
                </div>
            </form>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}