diff --git a/plugins/remote_user/lib/remote_user_plugin.rb b/plugins/remote_user/lib/remote_user_plugin.rb index 5e013df..6f8cfa5 100644 --- a/plugins/remote_user/lib/remote_user_plugin.rb +++ b/plugins/remote_user/lib/remote_user_plugin.rb @@ -28,9 +28,9 @@ class RemoteUserPlugin < Noosfero::Plugin end if !logged_in? - self.current_user = User.find_by_login(remote_user) + self.current_user = User.where(environment_id: environment, login: remote_user).first unless self.current_user - self.current_user = User.create!(:login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) + self.current_user = User.create!(:environment => environment, :login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) self.current_user.activate end self.current_user.save! @@ -39,9 +39,9 @@ class RemoteUserPlugin < Noosfero::Plugin self.current_user.forget_me reset_session - self.current_user = User.find_by_login(remote_user) + self.current_user = User.where(environment_id: environment, login: remote_user).first unless self.current_user - self.current_user = User.create!(:login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) + self.current_user = User.create!(:environment => environment, :login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) self.current_user.activate end self.current_user.save! -- libgit2 0.21.2