]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Use javascript to automatically submit confirmation forms
[rails.git] / app / controllers / user_controller.rb
index 21561736c53b6c78d57a5257d58a5b8c602be0ba..86b79e8f4d26636ac909a59bcce3b1750217ef76 100644 (file)
@@ -247,7 +247,7 @@ class UserController < ApplicationController
   end
 
   def confirm
   end
 
   def confirm
-    if params[:confirm_action]
+    if request.post?
       token = UserToken.find_by_token(params[:confirm_string])
       if token and !token.user.active?
         @user = token.user
       token = UserToken.find_by_token(params[:confirm_string])
       if token and !token.user.active?
         @user = token.user
@@ -264,13 +264,14 @@ class UserController < ApplicationController
           redirect_to :action => 'account', :display_name => @user.display_name
         end
       else
           redirect_to :action => 'account', :display_name => @user.display_name
         end
       else
-        flash.now[:error] = t 'user.confirm.failure'
+        flash[:error] = t 'user.confirm.failure'
+        redirect_to :action => 'login', :display_name => @user.display_name
       end
     end
   end
 
   def confirm_email
       end
     end
   end
 
   def confirm_email
-    if params[:confirm_action]
+    if request.post?
       token = UserToken.find_by_token(params[:confirm_string])
       if token and token.user.new_email?
         @user = token.user
       token = UserToken.find_by_token(params[:confirm_string])
       if token and token.user.new_email?
         @user = token.user
@@ -286,7 +287,8 @@ class UserController < ApplicationController
         session[:user] = @user.id
         redirect_to :action => 'account', :display_name => @user.display_name
       else
         session[:user] = @user.id
         redirect_to :action => 'account', :display_name => @user.display_name
       else
-        flash.now[:error] = t 'user.confirm_email.failure'
+        flash[:error] = t 'user.confirm_email.failure'
+        redirect_to :action => 'account', :display_name => @user.display_name
       end
     end
   end
       end
     end
   end