{{define "title"}}Log In{{end}}
{{define "content"}}
<div class="container">
    <section class="hero is-info is-bold">
        <div class="hero-body">
            <div class="container">
                <h1 class="title">Reset Password</h1>
            </div>
        </div>
    </section>

    <div class="block p-4">
        <form action="/forgot-password" method="POST">
            {{ InputCSRF }}

            <!-- With token: set a new password -->
            {{if and .Token .User}}
                <input type="hidden" name="token" value="{{.Token.Token}}">

                <div class="field">
                    <label class="label">Username:</label>
                    <p>{{.User.Username}}</p>
                </div>

                <div class="field">
                    <label class="label" for="password">New password:</label>
                    <input type="password" class="input"
                        name="password"
                        id="password"
                        placeholder="Password">
                </div>

                <div class="field">
                    <label class="label" for="confirm">Confirm new password:</label>
                    <input type="password" class="input"
                        name="confirm"
                        id="confirm"
                        placeholder="Password">
                </div>

                <div class="field">
                    <button type="submit" class="button is-primary">Set password and sign in</button>
                </div>
            {{else}}
                <p class="block">
                    Forgot your password? Enter your account username or email address below and we can
                    e-mail you a link to set a new password.
                </p>

                <div class="field">
                    <label class="label" for="username">Username or email:</label>
                    <input type="text" class="input" name="username" placeholder="username" autocomplete="off" required>
                </div>

                <div class="field">
                    <button type="submit" class="button is-primary">Send me a link to reset my password</button>
                </div>
            {{end}}
        </form>
    </div>
</div>
{{end}}