← back to AbramsOS
views/signin.ejs
36 lines
<%- include('partials/header', { title: 'Sign in' }) %>
<section class="auth-card glass">
<% if (stage === 'password') { %>
<h1>Sign in</h1>
<% if (error) { %><p class="error-banner"><%= error %></p><% } %>
<form method="post" action="/signin" autocomplete="off">
<input type="hidden" name="stage" value="password">
<input type="hidden" name="_csrf" value="<%= csrfToken %>">
<input type="hidden" name="next" value="<%= next %>">
<label>Email
<input type="email" name="email" required autofocus>
</label>
<label>Password
<input type="password" name="password" required autocomplete="current-password">
</label>
<button class="button primary" type="submit">Continue</button>
</form>
<% } else if (stage === 'totp') { %>
<h1>Two-factor code</h1>
<p class="subtle">Open your authenticator app and enter the 6-digit code.</p>
<% if (error) { %><p class="error-banner"><%= error %></p><% } %>
<form method="post" action="/signin" autocomplete="off">
<input type="hidden" name="stage" value="totp">
<input type="hidden" name="_csrf" value="<%= csrfToken %>">
<input type="hidden" name="next" value="<%= next %>">
<label>6-digit code
<input type="text" name="token" inputmode="numeric" pattern="[0-9 ]{6,8}" maxlength="8" required autofocus>
</label>
<button class="button primary" type="submit">Verify</button>
</form>
<% } %>
</section>
<%- include('partials/footer') %>