From c1eed7136c6298afe1638c0f748e37742d9088b6 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 15 Jul 2013 23:01:07 +0200 Subject: [PATCH] Show gravatar avatar --- scrumli.asd | 2 +- scrumli.lisp | 5 +++++ templates/scrumli.tmpl | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scrumli.asd b/scrumli.asd index 87d124a..473ba00 100644 --- a/scrumli.asd +++ b/scrumli.asd @@ -8,7 +8,7 @@ :author "Tom Willemse" :license "AGPLv3" :depends-on (:restas :sexml :postmodern :cl-json :drakma - :closure-template) + :closure-template :md5) :defsystem-depends-on (:closure-template) :components ((:closure-template "templates/scrumli") (:file "defmodule") diff --git a/scrumli.lisp b/scrumli.lisp index 22ce5d7..8fb5a18 100644 --- a/scrumli.lisp +++ b/scrumli.lisp @@ -52,6 +52,10 @@ (<:a :class "brand" "scrumli") ,@body)))) +(defun md5-hash (str) + (string-downcase (format nil "~{~2,'0x~}" + (coerce (md5:md5sum-string str) 'list)))) + (define-route main ("") (if (logged-in-p) (scrumli-templates:main @@ -64,6 +68,7 @@ *scrumli-react-js-location* *scrumli-jsxtransformer-js-location*) :username ,(hunchentoot:session-value :username) + :usermd5 ,(md5-hash (hunchentoot:session-value :username)) :ulogout ,(genurl 'logout-page) :umainjs ,(genurl 'main-js))) (redirect 'login-page))) diff --git a/templates/scrumli.tmpl b/templates/scrumli.tmpl index 1deb32c..5f4930c 100644 --- a/templates/scrumli.tmpl +++ b/templates/scrumli.tmpl @@ -21,6 +21,7 @@ scrumli
+ {$username}