             opts.locals.view = file.replace(/\..*$/,'').replace(/\//,'-')
             opts.locals.ctx = ctx
             res.render file, opts
-          currentPerson: person,
+          currentPerson: person
+          setCurrentPerson: (person, options) ->
+            @cookie 'authkey', person?.authKey(), options
           redirectToTeam: (person, alternatePath) ->
             Team.first { 'members._id': person._id }, (error, team) =>
               if team?

      person.resetPassword =>
        @res.send 'OK', 200


# # # # update person
# # # app.put '/people/:id', ->

# # #       person.update attributes
# # #       person.save (error, resp) =>
# # #         @redirectToTeam person
# # # 
# # # get '/logout', ->
# # #   @redirect '/' unless @currentPerson?
