Show gravatar avatar

This commit is contained in:
Tom Willemse 2013-07-15 23:01:07 +02:00
parent cfab0475f3
commit c1eed7136c
3 changed files with 7 additions and 1 deletions

View file

@ -8,7 +8,7 @@
:author "Tom Willemse" :author "Tom Willemse"
:license "AGPLv3" :license "AGPLv3"
:depends-on (:restas :sexml :postmodern :cl-json :drakma :depends-on (:restas :sexml :postmodern :cl-json :drakma
:closure-template) :closure-template :md5)
:defsystem-depends-on (:closure-template) :defsystem-depends-on (:closure-template)
:components ((:closure-template "templates/scrumli") :components ((:closure-template "templates/scrumli")
(:file "defmodule") (:file "defmodule")

View file

@ -52,6 +52,10 @@
(<:a :class "brand" "scrumli") (<:a :class "brand" "scrumli")
,@body)))) ,@body))))
(defun md5-hash (str)
(string-downcase (format nil "~{~2,'0x~}"
(coerce (md5:md5sum-string str) 'list))))
(define-route main ("") (define-route main ("")
(if (logged-in-p) (if (logged-in-p)
(scrumli-templates:main (scrumli-templates:main
@ -64,6 +68,7 @@
*scrumli-react-js-location* *scrumli-react-js-location*
*scrumli-jsxtransformer-js-location*) *scrumli-jsxtransformer-js-location*)
:username ,(hunchentoot:session-value :username) :username ,(hunchentoot:session-value :username)
:usermd5 ,(md5-hash (hunchentoot:session-value :username))
:ulogout ,(genurl 'logout-page) :ulogout ,(genurl 'logout-page)
:umainjs ,(genurl 'main-js))) :umainjs ,(genurl 'main-js)))
(redirect 'login-page))) (redirect 'login-page)))

View file

@ -21,6 +21,7 @@
<a class="brand">scrumli</a> <a class="brand">scrumli</a>
<div class="pull-right"> <div class="pull-right">
<span class="navbar-text"> <span class="navbar-text">
<img src="https://secure.gravatar.com/avatar/{$usermd5}?s=16" />
{$username} {$username}
</span> </span>
<ul class="nav pull-right"> <ul class="nav pull-right">