Skip to content

Commit

Permalink
expires are added at set_cookie.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanying committed Jun 25, 2009
1 parent a5d1bd3 commit ec7a143
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ def json_request(request)
end

post "/login" do
response.set_cookie('u', params['username'])
response.set_cookie('p', encrypt(params['password']))
expire_date = Time.now + 2 * 7 * 24 * 60 * 60
response.set_cookie('u', :value => params['username'], :expires => expire_date)
response.set_cookie('p', :value => encrypt(params['password']), :expires => expire_date)

redirect request.env['SCRIPT_NAME'] + '/'
end

0 comments on commit ec7a143

Please sign in to comment.