Commit a4b7f957fd55174083fc29dbec2fbf10df8ee507
Exists in
master
and in
20 other branches
Merge branch 'remote_user_fix' into 'master'
Change remote user plugin to handle any exception Small fix to handle any possiblie exception in remote user plugin See merge request !612
Showing
2 changed files
with
11 additions
and
3 deletions
Show diff stats
plugins/remote_user/lib/remote_user_plugin.rb
plugins/remote_user/test/functional/remote_user_plugin_test.rb
| ... | ... | @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' |
| 3 | 3 | # Re-raise errors caught by the controller. |
| 4 | 4 | class AccountController; def rescue_action(e) raise e end; end |
| 5 | 5 | |
| 6 | -class AccountControllerTest < ActionController::TestCase | |
| 6 | +class AccountControllerTest < ActionController::TestCase | |
| 7 | 7 | def setup |
| 8 | 8 | @environment = Environment.default |
| 9 | 9 | @environment.enabled_plugins = ['RemoteUserPlugin'] |
| ... | ... | @@ -125,10 +125,18 @@ class AccountControllerTest < ActionController::TestCase |
| 125 | 125 | get :index |
| 126 | 126 | |
| 127 | 127 | assert session[:user].blank? |
| 128 | - | |
| 128 | + | |
| 129 | 129 | @request.env["HTTP_REMOTE_USER"] = "" |
| 130 | 130 | get :index |
| 131 | 131 | |
| 132 | 132 | assert session[:user].blank? |
| 133 | 133 | end |
| 134 | + | |
| 135 | + should 'not create a new user if his informations is invalid' do | |
| 136 | + @request.env["HTTP_REMOTE_USER"] = "*%&invalid user name&%*" | |
| 137 | + get :index | |
| 138 | + | |
| 139 | + assert session[:user].blank? | |
| 140 | + assert_response 404 | |
| 141 | + end | |
| 134 | 142 | end | ... | ... |