Fixed registration form broken by r8479.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8782 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-02-05 12:17:29 +00:00
parent d57fbc9512
commit 9f6496b0bc
3 changed files with 14 additions and 7 deletions

View File

@ -96,7 +96,7 @@ class AccountController < ApplicationController
end
else
@user.login = params[:user][:login]
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation]
case Setting.self_registration
when '1'

View File

@ -167,6 +167,9 @@ class AccountControllerTest < ActionController::TestCase
assert_response :success
assert_template 'register'
assert_not_nil assigns(:user)
assert_tag 'input', :attributes => {:name => 'user[password]'}
assert_tag 'input', :attributes => {:name => 'user[password_confirmation]'}
end
end
@ -193,6 +196,10 @@ class AccountControllerTest < ActionController::TestCase
end
user = User.first(:order => 'id DESC')
assert_equal 'register', user.login
assert_equal 'John', user.firstname
assert_equal 'Doe', user.lastname
assert_equal 'register@example.com', user.mail
assert user.check_password?('test')
assert user.active?
end
end

View File

@ -103,8 +103,8 @@ class AccountTest < ActionController::IntegrationTest
assert_response :success
assert_template 'account/register'
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
:password => "newpass", :password_confirmation => "newpass"
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar",
:password => "newpass", :password_confirmation => "newpass"}
assert_redirected_to '/my/account'
follow_redirect!
assert_response :success
@ -119,8 +119,8 @@ class AccountTest < ActionController::IntegrationTest
def test_register_with_manual_activation
Setting.self_registration = '2'
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
:password => "newpass", :password_confirmation => "newpass"
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar",
:password => "newpass", :password_confirmation => "newpass"}
assert_redirected_to '/login'
assert !User.find_by_login('newuser').active?
end
@ -129,8 +129,8 @@ class AccountTest < ActionController::IntegrationTest
Setting.self_registration = '1'
Token.delete_all
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
:password => "newpass", :password_confirmation => "newpass"
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar",
:password => "newpass", :password_confirmation => "newpass"}
assert_redirected_to '/login'
assert !User.find_by_login('newuser').active?