       person.resetPassword =>
         @res.send 'OK', 200
 
+post '/login', ->
+  Person.login @req.body, (error, person) =>
+    if person?
+      if @req.param 'remember'
+        d = new Date()
+        d.setTime(d.getTime() + 1000 * 60 * 60 * 24 * 180)
+        options = { expires: d }
+      @setCurrentPerson person, options
+      if person.name
+        if returnTo = @req.param('return_to')
+          @redirect returnTo
+        else @redirectToTeam person
+      else
+        @redirect '/people/' + person.id() + '/edit'
+    else
+      @errors = error
+      @person = new Person(@req.body)
+      @render 'login.html.haml'
 
 # # # # update person
 # # # app.put '/people/:id', ->

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

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