-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
261 lines (237 loc) · 11 KB
/
Copy pathprofile.html
File metadata and controls
261 lines (237 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Profile — Taskr</title>
<link rel="icon" href="/static/images/logo.svg" type="image/svg+xml"/>
<link rel="stylesheet" href="/static/css/style.css"/>
</head>
<body>
<nav class="navbar">
<div class="container">
<a href="/dashboard" class="navbar-brand"><span>Task</span>r</a>
<div class="navbar-nav">
<a href="/dashboard" class="nav-link">Dashboard</a>
<a href="/tasks" class="nav-link">Tasks</a>
<a href="/upload" class="nav-link">Files</a>
</div>
<div style="display:flex;align-items:center;gap:.75rem;">
<div class="nav-avatar" onclick="location.href='/profile'">JD</div>
<form method="POST" action="/logout" style="margin:0;">
<button type="submit" class="btn btn-ghost btn-sm">Sign out</button>
</form>
</div>
</div>
</nav>
<div class="dashboard-layout">
<aside class="sidebar">
<div class="sidebar-section">
<div class="sidebar-label">Menu</div>
<a href="/dashboard" class="sidebar-link">
<svg class="sidebar-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
Overview
</a>
<a href="/tasks" class="sidebar-link">
<svg class="sidebar-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><polyline points="3 6 4 7 6 5"/><polyline points="3 12 4 13 6 11"/><polyline points="3 18 4 19 6 17"/></svg>
All Tasks
</a>
</div>
<div style="margin-top:auto;">
<a href="/profile" class="sidebar-link active">
<svg class="sidebar-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
Profile & Settings
</a>
</div>
</aside>
<main class="main-content" style="max-width:760px;">
<div id="alert-zone"></div>
<div class="profile-header">
<!--
Go: POST /profile/avatar → multipart upload
r.FormFile("avatar") → resize, save, update user record
-->
<div class="profile-avatar-upload">
<div class="profile-avatar">JD</div>
<div class="profile-avatar-overlay">Change</div>
<input type="file" name="avatar" accept="image/*"
title="Upload profile photo"/>
</div>
<div>
<!-- Go: {{.User.Name}}, {{.User.Email}} -->
<h1 style="font-size:1.4rem; font-weight:800;">Jane Doe</h1>
<p class="text-muted text-sm">jane@example.com</p>
<p class="text-xs text-muted" style="font-family:var(--mono); margin-top:.3rem;">
Member since April 2026 · 12 tasks created
</p>
</div>
</div>
<!-- Tabs -->
<div class="tabs">
<div class="tab active" data-tab="tab-profile">Profile</div>
<div class="tab" data-tab="tab-password">Password</div>
<div class="tab" data-tab="tab-notifications">Notifications</div>
<div class="tab" data-tab="tab-danger">Danger Zone</div>
</div>
<!-- Tab: Profile -->
<div class="tab-panel active" id="tab-profile">
<!--
Go: POST /profile → update name, email
Validate email uniqueness, re-render form with errors
-->
<form method="POST" action="/profile">
<input type="hidden" name="csrf_token" value="REPLACE_WITH_TOKEN"/>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:1rem;">
<div class="form-group">
<label for="p-name">Full name</label>
<!-- Go: value="{{.User.Name}}" -->
<input class="form-control" type="text" id="p-name" name="name" value="Jane Doe" required/>
</div>
<div class="form-group">
<label for="p-email">Email address</label>
<input class="form-control" type="email" id="p-email" name="email"
value="jane@example.com" required/>
</div>
</div>
<div class="form-group">
<label for="p-bio">Bio</label>
<textarea class="form-control" id="p-bio" name="bio" rows="3"
data-maxlength="200"
placeholder="A short description about yourself…">Go backend developer in training.</textarea>
</div>
<div class="form-group">
<label for="p-timezone">Timezone</label>
<select class="form-control" id="p-timezone" name="timezone">
<option value="UTC">UTC</option>
<option value="Africa/Lagos" selected>Africa/Lagos (WAT)</option>
<option value="Europe/London">Europe/London (GMT)</option>
<option value="America/New_York">America/New_York (EST)</option>
</select>
</div>
<div style="display:flex; justify-content:flex-end;">
<button type="submit" class="btn btn-primary">Save profile</button>
</div>
</form>
</div>
<!-- Tab: Password -->
<div class="tab-panel" id="tab-password">
<!--
Go: POST /profile/password
Verify current password with bcrypt.CompareHashAndPassword
Hash new password with bcrypt.GenerateFromPassword
-->
<form method="POST" action="/profile/password">
<input type="hidden" name="csrf_token" value="REPLACE_WITH_TOKEN"/>
<div class="form-group">
<label for="pw-current">Current password</label>
<input class="form-control" type="password" id="pw-current" name="current_password"
placeholder="••••••••" autocomplete="current-password" required/>
</div>
<div class="form-group">
<label for="pw-new">New password</label>
<input class="form-control" type="password" id="pw-new" name="new_password"
placeholder="••••••••" autocomplete="new-password" required/>
<span class="form-hint">Min 8 characters</span>
</div>
<div class="form-group">
<label for="pw-confirm">Confirm new password</label>
<input class="form-control" type="password" id="pw-confirm" name="new_password_confirm"
placeholder="••••••••" autocomplete="new-password" required/>
</div>
<div style="display:flex; justify-content:flex-end;">
<button type="submit" class="btn btn-primary">Update password</button>
</div>
</form>
</div>
<!-- Tab: Notifications -->
<div class="tab-panel" id="tab-notifications">
<!--
Go: POST /profile/notifications → save user preferences
Store as JSON blob or separate columns in user record
-->
<form method="POST" action="/profile/notifications">
<input type="hidden" name="csrf_token" value="REPLACE_WITH_TOKEN"/>
<div class="settings-row">
<div>
<div class="settings-label">Email on task due</div>
<div class="settings-desc">Receive an email 24 hours before a task is due.</div>
</div>
<input type="checkbox" name="notify_due" checked class="visually-hidden"/>
<div class="toggle on"></div>
</div>
<div class="settings-row">
<div>
<div class="settings-label">Weekly digest</div>
<div class="settings-desc">A summary of your tasks every Monday morning.</div>
</div>
<input type="checkbox" name="notify_digest" class="visually-hidden"/>
<div class="toggle"></div>
</div>
<div class="settings-row">
<div>
<div class="settings-label">Task completed</div>
<div class="settings-desc">Notify me when a shared task is marked complete.</div>
</div>
<input type="checkbox" name="notify_complete" checked class="visually-hidden"/>
<div class="toggle on"></div>
</div>
<div style="display:flex; justify-content:flex-end; margin-top:1.5rem;">
<button type="submit" class="btn btn-primary">Save preferences</button>
</div>
</form>
</div>
<!-- Tab: Danger Zone -->
<div class="tab-panel" id="tab-danger">
<div class="alert alert-error mb-2">
<span>⚠️</span>
<span>Actions in this section are permanent and cannot be undone.</span>
</div>
<div class="card" style="border-color:rgba(255,107,107,.3);">
<div class="settings-row" style="padding-top:0;">
<div>
<div class="settings-label text-danger">Delete all tasks</div>
<div class="settings-desc">Permanently delete all your tasks and attachments.</div>
</div>
<!-- Go: POST /tasks/delete-all → confirm ownership, delete cascade -->
<form method="POST" action="/tasks/delete-all" style="margin:0;">
<input type="hidden" name="csrf_token" value="REPLACE"/>
<button class="btn btn-danger btn-sm"
onclick="return confirm('Delete ALL tasks? This cannot be undone.')">
Delete all tasks
</button>
</form>
</div>
<div class="settings-row">
<div>
<div class="settings-label text-danger">Delete account</div>
<div class="settings-desc">Permanently delete your account and all associated data.</div>
</div>
<!-- Go: POST /account/delete → verify password, hard delete user + cascade -->
<form method="POST" action="/account/delete" style="margin:0;">
<input type="hidden" name="csrf_token" value="REPLACE"/>
<button class="btn btn-danger btn-sm"
onclick="return confirm('Delete your account? This CANNOT be undone.')">
Delete account
</button>
</form>
</div>
</div>
<!-- Routes reference -->
<div class="card mt-3">
<div class="card-title" style="margin-bottom:.85rem; font-size:.8rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted);">Routes on this page</div>
<div style="display:flex; flex-wrap:wrap; gap:.4rem;">
<span class="route-pill"><span class="method">GET</span>/profile</span>
<span class="route-pill"><span class="method">POST</span>/profile</span>
<span class="route-pill"><span class="method">POST</span>/profile/avatar</span>
<span class="route-pill"><span class="method">POST</span>/profile/password</span>
<span class="route-pill"><span class="method">POST</span>/profile/notifications</span>
<span class="route-pill"><span class="method">POST</span>/tasks/delete-all</span>
<span class="route-pill"><span class="method">POST</span>/account/delete</span>
</div>
</div>
</div>
</main>
</div>
<script src="/static/js/app.js"></script>
</body>
</html>