           res: res
           next: next
           redirect: __bind(res.redirect, res),
-          cookie: (key, value) ->
-            res.header('Set-Cookie', "#{key}=#{value}")
+          cookie: (key, value, options) ->
+            value ||= ''
+            options ||= {}
+            cookie = "#{key}=#{value}"
+            for k, v of options
+              cookie += "; #{k}=#{v}"
+            res.header('Set-Cookie', cookie)
           render: (file, opts) ->
             opts ||= {}
             opts.locals ||= {}

            res.render file, opts
          currentPerson: person
          setCurrentPerson: (person, options) ->
            @cookie 'authkey', person?.authKey(), options
          redirectToTeam: (person, alternatePath) ->
            Team.first { 'members._id': person._id }, (error, team) =>
              if team?

        @errors = errors
        @render 'teams/new.html.haml'
      else
        @cookie 'teamAuthKey', @team.authKey()
        @redirect '/teams/' + @team.id()

# show team
