diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index ba3fbde..7b0fb1d 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -87,7 +87,7 @@ class AccountController < ApplicationController @person.environment = @user.environment unless @user.environment.enabled?('admin_must_approve_new_users') if request.post? - @person.update_attributes(params[:profile_data]) + @person.attributes = params[:profile_data] if may_be_a_bot set_signup_start_time_for_now @block_bot = true diff --git a/app/models/create_user.rb b/app/models/create_user.rb index d68f69e..c487d4d 100644 --- a/app/models/create_user.rb +++ b/app/models/create_user.rb @@ -26,17 +26,12 @@ class CreateUser < Task end def perform - user = User.new - person = Person.new(person_data) + user = User.new(user_data) + user.person = Person.new(person_data) author_name = user.name - user_data = self.data.reject do |key, value| - ! DATA_FIELDS.include?(key.to_s) - end - person.update_attributes(@person) - user.update_attributes(user_data) user.environment = self.environment - person.environment = user.environment - user.save! + user.person.environment = user.environment + user.signup! end def title @@ -69,4 +64,14 @@ class CreateUser < Task def target_notification_message _("User \"%{user}\" just requested to register. You have to approve or reject it through the \"Pending Validations\" section in your control panel.\n") % { :user => self.name } end + + protected + + def user_data + user_data = self.data.reject do |key, value| + !DATA_FIELDS.include?(key.to_s) + end + + user_data + end end \ No newline at end of file diff --git a/features/signup.feature b/features/signup.feature index 4b57f73..fd11fbd 100644 --- a/features/signup.feature +++ b/features/signup.feature @@ -312,8 +312,8 @@ Feature: signup And feature "skip_new_user_email_confirmation" is enabled on environment And I go to /account/signup And I fill in "Username" with "teste" - And I fill in "Password" with "1234" - And I fill in "Password confirmation" with "1234" + And I fill in "Password" with "123456" + And I fill in "Password confirmation" with "123456" And I fill in "e-Mail" with "teste@teste.com" And I fill in "Full name" with "Teste da Silva" And I press "Create my account" @@ -325,7 +325,7 @@ Feature: signup And I follow "Logout" And I follow "Login" And I fill in "Username / Email" with "teste" - And I fill in "Password" with "1234" + And I fill in "Password" with "123456" And I press "Log in" Then I should see "teste" -- libgit2 0.21.2