module.exports = myprofile

function myprofile (req, cb) {
  req.session.get('profile', function (er, prof) {
    if (er || prof) return cb(er, prof)
    // if we're logged in, try to see if we can get it
    var name = req.cookies.get('name')
    if (!name) return cb()
    var pu = '/_users/org.couchdb.user:' + name
    req.couch.get(pu, function (er, cr, data) {
      if (er || cr.statusCode !== 200) {
        // Oh well.  Probably the login expired.
        return cb(er)
      }
      req.session.set('profile', data)
      return cb(null, data)
    })
  })
}

@@ -21,16 +21,56 @@
 rofile%0A%0A
+var gravatar = require('gravatar').url%0A%0A
 function
@@ -139,15 +139,113 @@
 er, 
-prof) %7B
+data) %7B%0A    if (data && data.email) %7B%0A      data.gravatar = gravatar(data.email, %7Bs:50, d:'retro'%7D)%0A    %7D
 %0A   
@@ -255,20 +255,20 @@
  (er %7C%7C 
-prof
+data
 ) return
@@ -279,13 +279,14 @@
 er, 
-prof)
+data)%0A
 %0A   
@@ -403,16 +403,17 @@
 rn cb()%0A
+%0A
     var 
@@ -616,24 +616,120 @@
 er)%0A      %7D%0A
+      if (data.email) %7B%0A        data.gravatar = gravatar(data.email, %7Bs:50, d:'retro'%7D)%0A      %7D%0A
       req.se

Add gravatar to myprofile