Skip to content

Commit eadec28

Browse files
Create profile.html
1 parent 1d7cee9 commit eadec28

File tree

1 file changed

+227
-0
lines changed

1 file changed

+227
-0
lines changed

app/templates/profile.html

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<div class="container">
5+
<h2>Profile</h2>
6+
7+
{% with messages = get_flashed_messages(with_categories=true) %}
8+
{% if messages %}
9+
{% for category, message in messages %}
10+
<div class="alert alert-{{ category }}">{{ message }}</div>
11+
{% endfor %}
12+
{% endif %}
13+
{% endwith %}
14+
15+
<div class="profile-info">
16+
<h3>Account Information</h3>
17+
<div class="info-grid">
18+
<div class="info-item">
19+
<label>Username:</label>
20+
<span>{{ current_user.username }}</span>
21+
</div>
22+
23+
<div class="info-item">
24+
<label>Account Type:</label>
25+
<span>{{ 'Administrator' if current_user.is_admin else 'User' }}</span>
26+
</div>
27+
28+
<div class="info-item">
29+
<label>Member Since:</label>
30+
<span>{{ current_user.created_at.strftime('%B %d, %Y') if current_user.created_at else 'Unknown' }}</span>
31+
</div>
32+
33+
<div class="info-item">
34+
<label>Last Login:</label>
35+
<span>{{ current_user.last_login.strftime('%B %d, %Y at %I:%M %p') if current_user.last_login else 'Never' }}</span>
36+
</div>
37+
</div>
38+
</div>
39+
40+
<div class="security-section">
41+
<h3>Security Settings</h3>
42+
43+
<div class="security-item">
44+
<h4>Password</h4>
45+
<p>Keep your account secure with a strong password.</p>
46+
<a href="{{ url_for('auth.change_password') }}" class="btn-primary">Change Password</a>
47+
</div>
48+
49+
<div class="security-item">
50+
<h4>Two-Factor Authentication (2FA)</h4>
51+
{% if current_user.totp_enabled %}
52+
<p class="status-enabled">✓ 2FA is currently enabled</p>
53+
<form method="POST" action="{{ url_for('auth.disable_2fa') }}" style="display: inline;">
54+
<button type="submit" class="btn-danger"
55+
onclick="return confirm('Are you sure you want to disable 2FA?')">
56+
Disable 2FA
57+
</button>
58+
</form>
59+
{% else %}
60+
<p class="status-disabled">✗ 2FA is currently disabled</p>
61+
<a href="{{ url_for('auth.setup_2fa') }}" class="btn-primary">Enable 2FA</a>
62+
{% endif %}
63+
</div>
64+
</div>
65+
66+
<div class="directadmin-section">
67+
<h3>DirectAdmin Configuration</h3>
68+
<div class="da-status">
69+
{% if current_user.has_da_config() %}
70+
<p class="status-enabled">✓ DirectAdmin is configured</p>
71+
<div class="da-info">
72+
<p><strong>Server:</strong> {{ current_user.da_server }}</p>
73+
<p><strong>Username:</strong> {{ current_user.da_username }}</p>
74+
<p><strong>Domain:</strong> {{ current_user.da_domain }}</p>
75+
</div>
76+
{% else %}
77+
<p class="status-disabled">✗ DirectAdmin is not configured</p>
78+
<p>Configure your DirectAdmin settings to start managing email forwarders.</p>
79+
{% endif %}
80+
<a href="{{ url_for('settings.index') }}" class="btn-primary">
81+
{{ 'Update' if current_user.has_da_config() else 'Configure' }} DirectAdmin Settings
82+
</a>
83+
</div>
84+
</div>
85+
</div>
86+
87+
<style>
88+
.container {
89+
max-width: 800px;
90+
margin: 2rem auto;
91+
padding: 0 1rem;
92+
}
93+
94+
.profile-info, .security-section, .directadmin-section {
95+
background: white;
96+
padding: 2rem;
97+
border-radius: 8px;
98+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
99+
margin-bottom: 2rem;
100+
}
101+
102+
.info-grid {
103+
display: grid;
104+
grid-template-columns: repeat(2, 1fr);
105+
gap: 1rem;
106+
margin-top: 1rem;
107+
}
108+
109+
@media (max-width: 600px) {
110+
.info-grid {
111+
grid-template-columns: 1fr;
112+
}
113+
}
114+
115+
.info-item label {
116+
font-weight: bold;
117+
display: block;
118+
color: #666;
119+
margin-bottom: 0.25rem;
120+
font-size: 0.9rem;
121+
}
122+
123+
.info-item span {
124+
font-size: 1.1rem;
125+
}
126+
127+
.security-item, .da-status {
128+
padding: 1.5rem 0;
129+
border-bottom: 1px solid #eee;
130+
}
131+
132+
.security-item:last-child, .da-status:last-child {
133+
border-bottom: none;
134+
padding-bottom: 0;
135+
}
136+
137+
.security-item h4 {
138+
margin-bottom: 0.5rem;
139+
color: #333;
140+
}
141+
142+
.security-item p, .da-status p {
143+
margin-bottom: 1rem;
144+
color: #666;
145+
}
146+
147+
.status-enabled {
148+
color: #28a745;
149+
font-weight: bold;
150+
}
151+
152+
.status-disabled {
153+
color: #dc3545;
154+
}
155+
156+
.da-info {
157+
background: #f8f9fa;
158+
padding: 1rem;
159+
border-radius: 4px;
160+
margin: 1rem 0;
161+
}
162+
163+
.da-info p {
164+
margin: 0.25rem 0;
165+
font-size: 0.9rem;
166+
}
167+
168+
.btn-primary {
169+
background-color: #007bff;
170+
color: white;
171+
text-decoration: none;
172+
padding: 0.5rem 1rem;
173+
border-radius: 4px;
174+
border: none;
175+
cursor: pointer;
176+
display: inline-block;
177+
font-size: 1rem;
178+
}
179+
180+
.btn-primary:hover {
181+
background-color: #0056b3;
182+
}
183+
184+
.btn-danger {
185+
background-color: #dc3545;
186+
color: white;
187+
border: none;
188+
padding: 0.5rem 1rem;
189+
border-radius: 4px;
190+
cursor: pointer;
191+
font-size: 1rem;
192+
}
193+
194+
.btn-danger:hover {
195+
background-color: #c82333;
196+
}
197+
198+
.alert {
199+
padding: 0.75rem 1rem;
200+
margin-bottom: 1rem;
201+
border-radius: 4px;
202+
}
203+
204+
.alert-error {
205+
background-color: #f8d7da;
206+
color: #721c24;
207+
border: 1px solid #f5c6cb;
208+
}
209+
210+
.alert-success {
211+
background-color: #d4edda;
212+
color: #155724;
213+
border: 1px solid #c3e6cb;
214+
}
215+
216+
.alert-info {
217+
background-color: #d1ecf1;
218+
color: #0c5460;
219+
border: 1px solid #bee5eb;
220+
}
221+
222+
h3 {
223+
margin-bottom: 1rem;
224+
color: #333;
225+
}
226+
</style>
227+
{% endblock %}

0 commit comments

Comments
 (0)