From 8d9301368dc8af8d178491f85f0dc390a5c1ee26 Mon Sep 17 00:00:00 2001 From: gered Date: Fri, 7 Jun 2013 19:16:33 -0400 Subject: [PATCH] added nicer looking 401 error page --- src/blarg/routes/auth.clj | 6 +++++- src/blarg/views/templates/unauthorized.html | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/blarg/views/templates/unauthorized.html diff --git a/src/blarg/routes/auth.clj b/src/blarg/routes/auth.clj index c46648d..9d9a7e2 100644 --- a/src/blarg/routes/auth.clj +++ b/src/blarg/routes/auth.clj @@ -30,8 +30,12 @@ (session/clear!) (resp/redirect "/")) +(defn handle-unauthorized [] + (->> (layout/render "unauthorized.html") + (resp/status 401))) + (defroutes auth-routes - (GET "/unauthorized" [] "Unauthorized.") + (GET "/unauthorized" [] (handle-unauthorized)) (GET "/login" [] (login-page)) (POST "/login" [id pass] (handle-login id pass)) (GET "/logout" [] (logout)) diff --git a/src/blarg/views/templates/unauthorized.html b/src/blarg/views/templates/unauthorized.html new file mode 100644 index 0000000..789037c --- /dev/null +++ b/src/blarg/views/templates/unauthorized.html @@ -0,0 +1,11 @@ +{% extends "blarg/views/templates/base.html" %} + +{% block content %} + + + +

You are not authorized to view that resource.

+ +{% endblock %}