Make the username cookie permanent
authorTom Hughes <tom@compton.nu>
Wed, 16 Nov 2011 10:05:39 +0000 (10:05 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 16 Nov 2011 10:05:39 +0000 (10:05 +0000)
app/controllers/user_controller.rb

index 5104715552b1bd77d5be860b0e0a18d9c852de58..de07e4b53c1938ff4400d5e05d6cb4b7ce16d9c4 100644 (file)
@@ -336,7 +336,7 @@ class UserController < ApplicationController
             token.destroy
 
             session[:user] = user.id
-            cookies["_osm_username"] = user.display_name
+            cookies.permanent["_osm_username"] = user.display_name
 
             if referer.nil?
               flash[:notice] = t('user.confirm.success') + "<br /><br />" + t('user.confirm.before you start')
@@ -389,7 +389,7 @@ class UserController < ApplicationController
         end
         token.destroy
         session[:user] = @user.id
-        cookies["_osm_username"] = @user.display_name
+        cookies.permanent["_osm_username"] = @user.display_name
         redirect_to :action => 'account', :display_name => @user.display_name
       else
         flash[:error] = t 'user.confirm_email.failure'
@@ -617,7 +617,7 @@ private
   ##
   # process a successful login
   def successful_login(user)
-    cookies["_osm_username"] = user.display_name
+    cookies.permanent["_osm_username"] = user.display_name
 
     session[:user] = user.id
     session_expires_after 1.month if session[:remember_me]