Skip to content

Commit

Permalink
admin: Add log out button
Browse files Browse the repository at this point in the history
  • Loading branch information
BBaoVanC committed Nov 5, 2023
1 parent 21ded32 commit 23ec804
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions isso/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ input {
color: #4d4c4c;
text-decoration: none;
}
.header .logout {
float: right;
}
.outer {
background-color: #eeeeee;
box-shadow: 0 0 0.5em #c0c0c0 inset;
Expand Down
1 change: 1 addition & 0 deletions isso/templates/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h2>Administration</h2>
</a>
</div>
</header>
<a class="logout" href="/logout">Log Out</a>
</div>
<div class="outer">
<div class="filters">
Expand Down
7 changes: 7 additions & 0 deletions isso/views/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class API(object):
('preview', ('POST', '/preview')),
('config', ('GET', '/config')),
('login', ('POST', '/login/')),
('logout', ('GET', '/logout')),
('admin', ('GET', '/admin/'))
]

Expand Down Expand Up @@ -1353,6 +1354,12 @@ def login(self, env, req):
isso_host_script = self.isso.conf.get("server", "public-endpoint") or local.host
return render_template('login.html', isso_host_script=isso_host_script)

def logout(self, env, req):
response = redirect("/admin")
response.headers.add("Set-Cookie", "admin-session=none; path=/; max-age=0;")
response.headers.add("X-Set-Cookie", "isso-admin-session=none; path=/; max-age=0;")
return response

"""
@api {get} /admin/ Admin interface
@apiGroup Admin
Expand Down

0 comments on commit 23ec804

Please sign in to comment.