Skip to content

Commit 303e16e

Browse files
committed
handle token param properly and add logout button
1 parent 691646b commit 303e16e

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

me/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<span class="user-handle" id="sidebar-handle">@username</span>
2727
</div>
2828
</div>
29+
<button class="logout-btn" onclick="logout()"><i data-lucide="log-out"></i>Logout</button>
2930
</div>
3031
</aside>
3132

@@ -52,6 +53,7 @@
5253
<span class="user-handle" id="mobile-sidebar-handle">@username</span>
5354
</div>
5455
</div>
56+
<button class="logout-btn" onclick="logout()"><i data-lucide="log-out"></i>Logout</button>
5557
</div>
5658
</div>
5759

@@ -306,7 +308,7 @@ <h2 class="modal-title">Authentication Required</h2>
306308
let token = params.get('token');
307309
if (token) {
308310
localStorage.setItem('rotur_token', token);
309-
history.replaceState({}, title, pathname);
311+
history.replaceState({}, document.title, window.location.pathname + window.location.hash);
310312
} else {
311313
token = localStorage.getItem('rotur_token');
312314
}
@@ -325,6 +327,11 @@ <h2 class="modal-title">Authentication Required</h2>
325327

326328
function closeModal(id) { el(id).classList.remove('active'); }
327329

330+
function logout() {
331+
localStorage.removeItem('rotur_token');
332+
window.location.href = '/';
333+
}
334+
328335
function formatDate(d) {
329336
return new Date(d).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
330337
}

me/style.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,32 @@ body {
113113
border-top: 1px solid var(--border);
114114
}
115115

116+
.logout-btn {
117+
width: 100%;
118+
display: flex;
119+
align-items: center;
120+
justify-content: center;
121+
gap: 0.5rem;
122+
padding: 0.625rem;
123+
margin-top: 0.75rem;
124+
background: transparent;
125+
border: 1px solid var(--danger);
126+
border-radius: 0.5rem;
127+
color: var(--danger);
128+
font-size: 0.875rem;
129+
cursor: pointer;
130+
transition: all 0.2s ease;
131+
}
132+
133+
.logout-btn:hover {
134+
background: rgba(248, 113, 113, 0.1);
135+
}
136+
137+
.logout-btn svg {
138+
width: 16px;
139+
height: 16px;
140+
}
141+
116142
.user-menu {
117143
display: flex;
118144
align-items: center;
@@ -1177,6 +1203,32 @@ body {
11771203
background: var(--bg-hover);
11781204
}
11791205

1206+
.mobile-sidebar-footer .logout-btn {
1207+
width: 100%;
1208+
display: flex;
1209+
align-items: center;
1210+
justify-content: center;
1211+
gap: 0.5rem;
1212+
padding: 0.625rem;
1213+
margin-top: 0.75rem;
1214+
background: transparent;
1215+
border: 1px solid var(--danger);
1216+
border-radius: 0.5rem;
1217+
color: var(--danger);
1218+
font-size: 0.875rem;
1219+
cursor: pointer;
1220+
transition: all 0.2s ease;
1221+
}
1222+
1223+
.mobile-sidebar-footer .logout-btn:hover {
1224+
background: rgba(248, 113, 113, 0.1);
1225+
}
1226+
1227+
.mobile-sidebar-footer .logout-btn svg {
1228+
width: 16px;
1229+
height: 16px;
1230+
}
1231+
11801232
/* Bio value styling */
11811233
.bio-value {
11821234
flex-direction: column;

0 commit comments

Comments
 (0)