@@ -93,7 +93,13 class ApplicationController < ActionController::Base | |||||
93 |
|
93 | |||
94 | def require_login |
|
94 | def require_login | |
95 | if !User.current.logged? |
|
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 | return false |
|
103 | return false | |
98 | end |
|
104 | end | |
99 | true |
|
105 | true |
@@ -40,4 +40,10 class AdminTest < ActionController::IntegrationTest | |||||
40 | locked_user = User.try_to_login("psmith", "psmith09") |
|
40 | locked_user = User.try_to_login("psmith", "psmith09") | |
41 | assert_equal nil, locked_user |
|
41 | assert_equal nil, locked_user | |
42 | end |
|
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 | end |
|
49 | end |
General Comments 0
You need to be logged in to leave comments.
Login now