IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit 3dd5f287 authored by Emi Simpson's avatar Emi Simpson
Browse files

Added logout button

parent 9897a3a7
......@@ -319,12 +319,20 @@ def action_set_high_contrast(_: Cursor) -> None:
"""
session['high_contrast'] = request.form.get("enabled") != 'False'
def action_logout(_: Cursor) -> None:
"""
Logs the user out
"""
if 'id' in session:
del session['id']
ACTIONS: Dict[str, Callable[[Cursor], None]] = {
"delete_source": action_delete_source,
"remove_owner": action_remove_owner,
"edit": action_edit,
"set_high_contrast": action_set_high_contrast,
"delete_project": action_delete_project,
"logout": action_logout,
}
"""
A table of available actions
......
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out" id="log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
\ No newline at end of file
......@@ -29,7 +29,7 @@ nav > * {
text-transform: uppercase;
}
nav > a, #contrast-button {
nav > a, #contrast-button, #logout-button {
color: white;
}
......@@ -260,6 +260,12 @@ button {
#contrast-toggle:hover > label {
display: initial;
}
#logout > label {
display: none;
}
#logout:hover > label {
display: initial;
}
/* Footer */
footer {
......
......@@ -48,6 +48,16 @@
{{ utils.show_icon(toggle_icon, toggle_state + ' high contrast mode') }}
</button>
</form>
{% if login[0] != 'Login' %}
<form method=POST id="logout">
<input type=hidden name=action value=logout />
<input type=hidden name=id value=NA />
<label for="logout-button">Logout</label>
<button class=icon-button id="logout-button">
{{ utils.show_icon('log-out') }}
</button>
</form>
{%endif%}
<a href="{{login[1]}}" {% if selected is sameas "login" %} class='selected'{% endif %}>{{login[0]}}</a>
</nav>
<div> <!-- Errors -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment