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 end
else else
@user.login = params[:user][:login] @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 case Setting.self_registration
when '1' when '1'

View File

@ -167,6 +167,9 @@ class AccountControllerTest < ActionController::TestCase
assert_response :success assert_response :success
assert_template 'register' assert_template 'register'
assert_not_nil assigns(:user) assert_not_nil assigns(:user)
assert_tag 'input', :attributes => {:name => 'user[password]'}
assert_tag 'input', :attributes => {:name => 'user[password_confirmation]'}
end end
end end
@ -193,6 +196,10 @@ class AccountControllerTest < ActionController::TestCase
end end
user = User.first(:order => 'id DESC') user = User.first(:order => 'id DESC')
assert_equal 'register', user.login 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? assert user.active?
end end
end end

View File

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