added nicer looking 401 error page
This commit is contained in:
parent
e2357aaa1b
commit
8d9301368d
|
@ -30,8 +30,12 @@
|
||||||
(session/clear!)
|
(session/clear!)
|
||||||
(resp/redirect "/"))
|
(resp/redirect "/"))
|
||||||
|
|
||||||
|
(defn handle-unauthorized []
|
||||||
|
(->> (layout/render "unauthorized.html")
|
||||||
|
(resp/status 401)))
|
||||||
|
|
||||||
(defroutes auth-routes
|
(defroutes auth-routes
|
||||||
(GET "/unauthorized" [] "Unauthorized.")
|
(GET "/unauthorized" [] (handle-unauthorized))
|
||||||
(GET "/login" [] (login-page))
|
(GET "/login" [] (login-page))
|
||||||
(POST "/login" [id pass] (handle-login id pass))
|
(POST "/login" [id pass] (handle-login id pass))
|
||||||
(GET "/logout" [] (logout))
|
(GET "/logout" [] (logout))
|
||||||
|
|
11
src/blarg/views/templates/unauthorized.html
Normal file
11
src/blarg/views/templates/unauthorized.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "blarg/views/templates/base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<h2>Unauthorized</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>You are not authorized to view that resource.</p>
|
||||||
|
|
||||||
|
{% endblock %}
|
Reference in a new issue