]> source.dussan.org Git - redmine.git/commitdiff
Log the user in after registration if account activation is not needed.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 9 Jun 2008 18:59:15 +0000 (18:59 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 9 Jun 2008 18:59:15 +0000 (18:59 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1521 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/account_controller.rb
test/integration/account_test.rb

index b9224c158e174057081a8d663fd4f69a4716d85b..3fbbc89123cd4481fe2da0a63adf84f08ce5c55f 100644 (file)
@@ -134,8 +134,9 @@ class AccountController < ApplicationController
         # Automatic activation
         @user.status = User::STATUS_ACTIVE
         if @user.save
+          self.logged_user = @user
           flash[:notice] = l(:notice_account_activated)
-          redirect_to :action => 'login'
+          redirect_to :controller => 'my', :action => 'account'
         end
       else
         # Manual activation by the administrator
index e9d665d19d8b34f2681f875de72bd1fead06f147..a01a3ba09a668c19b8bb22e043b3125ce2c081a3 100644 (file)
@@ -67,8 +67,12 @@ class AccountTest < ActionController::IntegrationTest
     
     post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, 
                              :password => "newpass", :password_confirmation => "newpass"
-    assert_redirected_to 'account/login'
-    log_user('newuser', 'newpass')
+    assert_redirected_to 'my/account'
+    follow_redirect!
+    assert_response :success
+    assert_template 'my/account'
+    
+    assert User.find_by_login('newuser').active?
   end
   
   def test_register_with_manual_activation