Commit 7db6046a7ea5c392352cdbbf689d9486d47f1ef0
Exists in
master
and in
21 other branches
Merge branch 'remote_user_fix' into 'master'
Remote user fix Small fix in Remote user plugin: - When the remote user plugin creates a user, it doesn't activate it. See merge request !353
Showing
2 changed files
with
4 additions
and
0 deletions
Show diff stats
plugins/remote_user/lib/remote_user_plugin.rb
| @@ -24,6 +24,7 @@ class RemoteUserPlugin < Noosfero::Plugin | @@ -24,6 +24,7 @@ class RemoteUserPlugin < Noosfero::Plugin | ||
| 24 | self.current_user = User.find_by_login(remote_user) | 24 | self.current_user = User.find_by_login(remote_user) |
| 25 | unless self.current_user | 25 | unless self.current_user |
| 26 | self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) | 26 | self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) |
| 27 | + self.current_user.activate | ||
| 27 | end | 28 | end |
| 28 | self.current_user.save! | 29 | self.current_user.save! |
| 29 | else | 30 | else |
| @@ -34,6 +35,7 @@ class RemoteUserPlugin < Noosfero::Plugin | @@ -34,6 +35,7 @@ class RemoteUserPlugin < Noosfero::Plugin | ||
| 34 | self.current_user = User.find_by_login(remote_user) | 35 | self.current_user = User.find_by_login(remote_user) |
| 35 | unless self.current_user | 36 | unless self.current_user |
| 36 | self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) | 37 | self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) |
| 38 | + self.current_user.activate | ||
| 37 | end | 39 | end |
| 38 | self.current_user.save! | 40 | self.current_user.save! |
| 39 | end | 41 | end |
plugins/remote_user/test/functional/remote_user_plugin_test.rb
| @@ -52,6 +52,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -52,6 +52,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 52 | 52 | ||
| 53 | assert_equal 1, User.count | 53 | assert_equal 1, User.count |
| 54 | assert_equal "testuser", User.last.login | 54 | assert_equal "testuser", User.last.login |
| 55 | + assert_equal true, User.last.activated? | ||
| 55 | assert_equal User.last.id, session[:user] | 56 | assert_equal User.last.id, session[:user] |
| 56 | end | 57 | end |
| 57 | 58 | ||
| @@ -67,6 +68,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -67,6 +68,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 67 | 68 | ||
| 68 | assert_equal 2, User.count | 69 | assert_equal 2, User.count |
| 69 | assert_equal "another_user", User.last.login | 70 | assert_equal "another_user", User.last.login |
| 71 | + assert_equal true, User.last.activated? | ||
| 70 | assert_equal User.last.id, session[:user] | 72 | assert_equal User.last.id, session[:user] |
| 71 | end | 73 | end |
| 72 | end | 74 | end |