##// END OF EJS Templates
Fix 500 errors with a POST request that requires a login. #4216...
Eric Davis -
r2936:93bf1df5d40e
parent child
Show More
@@ -93,7 +93,13 class ApplicationController < ActionController::Base
93 93
94 94 def require_login
95 95 if !User.current.logged?
96 redirect_to :controller => "account", :action => "login", :back_url => url_for(params)
96 # Extract only the basic url parameters on non-GET requests
97 if request.get?
98 url = url_for(params)
99 else
100 url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id])
101 end
102 redirect_to :controller => "account", :action => "login", :back_url => url
97 103 return false
98 104 end
99 105 true
@@ -40,4 +40,10 class AdminTest < ActionController::IntegrationTest
40 40 locked_user = User.try_to_login("psmith", "psmith09")
41 41 assert_equal nil, locked_user
42 42 end
43
44 test "Add a user as an anonymous user should fail" do
45 post '/users/add', :user => { :login => 'psmith', :firstname => 'Paul'}, :password => "psmith09", :password_confirmation => "psmith09"
46 assert_response :redirect
47 assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fusers%2Fnew"
48 end
43 49 end
General Comments 0
You need to be logged in to leave comments. Login now