Commit ea3578f2cc4fa476734325f9555377f9bb97238c

Authored by AntonioTerceiro
1 parent 5e746850

ActionItem135: refactoring: extracting redirect to user initial page to a new method



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1163 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
app/controllers/public/account_controller.rb
... ... @@ -21,7 +21,7 @@ class AccountController < PublicController
21 21 self.current_user.remember_me
22 22 cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
23 23 end
24   - redirect_back_or_default(myprofile_path(:controller => 'profile_editor', :profile => current_user.login))
  24 + go_to_user_initial_page
25 25 flash[:notice] = _("Logged in successfully")
26 26 else
27 27 flash[:notice] = _('Incorrect username or password')
... ... @@ -42,7 +42,7 @@ class AccountController < PublicController
42 42 self.current_user = @user
43 43 owner_role = Role.find_by_name('owner')
44 44 @user.person.affiliate(@user.person, [owner_role]) if owner_role
45   - redirect_back_or_default(myprofile_path(:controller => 'profile_editor', :profile => current_user.login))
  45 + go_to_user_initial_page
46 46 flash[:notice] = _("Thanks for signing up!")
47 47 end
48 48 rescue ActiveRecord::RecordInvalid
... ... @@ -126,4 +126,9 @@ class AccountController < PublicController
126 126 def load_default_environment
127 127 @environment = Environment.default
128 128 end
  129 +
  130 + def go_to_user_initial_page
  131 + redirect_back_or_default(myprofile_path(:controller => 'profile_editor', :profile => current_user.login))
  132 + end
  133 +
129 134 end
... ...