]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/users_controller.rb
Use rails tokens for signup confirmations
[rails.git] / app / controllers / users_controller.rb
index 961be4024657a5eb80d206440461035f780a33af..429fa47a4096ec2174b0bc8bfb258677736eff95 100644 (file)
@@ -104,11 +104,11 @@ class UsersController < ApplicationController
         render :action => "new"
       elsif current_user.auth_provider.present?
         # Verify external authenticator before moving on
         render :action => "new"
       elsif current_user.auth_provider.present?
         # Verify external authenticator before moving on
-        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt")
+        session[:new_user] = current_user.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation")
         redirect_to auth_url(current_user.auth_provider, current_user.auth_uid), :status => :temporary_redirect
       else
         # Save the user record
         redirect_to auth_url(current_user.auth_provider, current_user.auth_uid), :status => :temporary_redirect
       else
         # Save the user record
-        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt")
+        session[:new_user] = current_user.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation")
         redirect_to :action => :terms
       end
     end
         redirect_to :action => :terms
       end
     end
@@ -203,8 +203,8 @@ class UsersController < ApplicationController
             session[:referer] = referer
             successful_login(current_user)
           else
             session[:referer] = referer
             successful_login(current_user)
           else
-            session[:token] = current_user.tokens.create.token
-            UserMailer.signup_confirm(current_user, current_user.tokens.create(:referer => referer)).deliver_later
+            session[:pending_user] = current_user.id
+            UserMailer.signup_confirm(current_user, current_user.generate_token_for(:new_user), referer).deliver_later
             redirect_to :controller => :confirmations, :action => :confirm, :display_name => current_user.display_name
           end
         else
             redirect_to :controller => :confirmations, :action => :confirm, :display_name => current_user.display_name
           end
         else