Commit ab83d73d025dd73e3b8a3caf7ed7b192ffba9d6a
1 parent
de2fad9c
Exists in
master
and in
29 other branches
After activation, redirects to login page
Showing
3 changed files
with
9 additions
and
3 deletions
Show diff stats
app/controllers/public/account_controller.rb
@@ -18,8 +18,13 @@ class AccountController < ApplicationController | @@ -18,8 +18,13 @@ class AccountController < ApplicationController | ||
18 | 18 | ||
19 | def activate | 19 | def activate |
20 | @user = User.find_by_activation_code(params[:activation_code]) if params[:activation_code] | 20 | @user = User.find_by_activation_code(params[:activation_code]) if params[:activation_code] |
21 | - session[:notice] = (@user and @user.activate) ? _("Your account has been activated, now you can log in!") : _("It looks like you're trying to activate an account. Perhaps have already activated this account?") | ||
22 | - redirect_back_or_default(:controller => 'home') | 21 | + if @user and @user.activate |
22 | + session[:notice] = _("Your account has been activated, now you can log in!") | ||
23 | + redirect_to :action => 'login', :userlogin => @user.login | ||
24 | + else | ||
25 | + session[:notice] = _("It looks like you're trying to activate an account. Perhaps have already activated this account?") | ||
26 | + redirect_back_or_default(:controller => 'home') | ||
27 | + end | ||
23 | end | 28 | end |
24 | 29 | ||
25 | # action to perform login to the application | 30 | # action to perform login to the application |
app/views/account/login.rhtml
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | 7 | ||
8 | <% labelled_form_for :user, @user, :url => login_url do |f| %> | 8 | <% labelled_form_for :user, @user, :url => login_url do |f| %> |
9 | 9 | ||
10 | - <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )' %> | 10 | + <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> |
11 | 11 | ||
12 | <%= f.password_field :password %> | 12 | <%= f.password_field :password %> |
13 | 13 |
test/functional/account_controller_test.rb
@@ -692,6 +692,7 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -692,6 +692,7 @@ class AccountControllerTest < Test::Unit::TestCase | ||
692 | should 'activate user when activation code is present and correct' do | 692 | should 'activate user when activation code is present and correct' do |
693 | user = User.create! :login => 'testuser', :password => 'test123', :password_confirmation => 'test123', :email => 'test@test.org' | 693 | user = User.create! :login => 'testuser', :password => 'test123', :password_confirmation => 'test123', :email => 'test@test.org' |
694 | get :activate, :activation_code => user.activation_code | 694 | get :activate, :activation_code => user.activation_code |
695 | + assert_redirected_to :action => :login, :userlogin => user.login | ||
695 | post :login, :user => {:login => 'testuser', :password => 'test123'} | 696 | post :login, :user => {:login => 'testuser', :password => 'test123'} |
696 | assert_not_nil session[:user] | 697 | assert_not_nil session[:user] |
697 | assert_redirected_to :controller => 'profile_editor', :profile => 'testuser' | 698 | assert_redirected_to :controller => 'profile_editor', :profile => 'testuser' |