Skip to content

Commit 9d60c70

Browse files
Create setup_2fa.html
1 parent 0972973 commit 9d60c70

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

app/templates/setup_2fa.html

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<div class="container">
5+
<h2>Enable Two-Factor Authentication</h2>
6+
7+
<div class="setup-2fa-container">
8+
<p>Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.):</p>
9+
10+
<div class="qr-code-container">
11+
<img src="{{ qr_code }}" alt="2FA QR Code" />
12+
</div>
13+
14+
<div class="manual-entry">
15+
<p>Or enter this code manually:</p>
16+
<code class="secret-code">{{ user.totp_secret }}</code>
17+
</div>
18+
19+
<form method="POST" class="verification-form">
20+
<div class="form-group">
21+
<label for="token">Enter the 6-digit code from your app:</label>
22+
<input type="text" id="token" name="token"
23+
pattern="[0-9]{6}" maxlength="6"
24+
placeholder="000000" required autofocus>
25+
</div>
26+
27+
<div class="form-actions">
28+
<button type="submit" class="btn-primary">Verify and Enable 2FA</button>
29+
<a href="{{ url_for('auth.profile') }}" class="btn-secondary">Cancel</a>
30+
</div>
31+
</form>
32+
</div>
33+
</div>
34+
35+
<style>
36+
.setup-2fa-container {
37+
max-width: 500px;
38+
margin: 0 auto;
39+
text-align: center;
40+
}
41+
42+
.qr-code-container {
43+
margin: 2rem 0;
44+
padding: 1rem;
45+
background: white;
46+
border: 1px solid #ddd;
47+
border-radius: 8px;
48+
}
49+
50+
.qr-code-container img {
51+
max-width: 250px;
52+
}
53+
54+
.manual-entry {
55+
margin: 2rem 0;
56+
}
57+
58+
.secret-code {
59+
display: block;
60+
margin: 1rem auto;
61+
padding: 0.5rem 1rem;
62+
background: #f5f5f5;
63+
border: 1px solid #ddd;
64+
border-radius: 4px;
65+
font-family: monospace;
66+
font-size: 1.1rem;
67+
letter-spacing: 0.1em;
68+
}
69+
70+
.verification-form {
71+
margin-top: 2rem;
72+
}
73+
74+
.verification-form input[type="text"] {
75+
font-size: 1.5rem;
76+
letter-spacing: 0.5em;
77+
text-align: center;
78+
width: 200px;
79+
margin: 0 auto;
80+
}
81+
</style>
82+
{% endblock %}

0 commit comments

Comments
 (0)