From a193058c473f17613895777310ef68a30fcdb63b Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Fri, 8 Aug 2008 14:16:00 +0000 Subject: [PATCH] ActionItem603: added welcome page --- app/controllers/public/account_controller.rb | 13 ++++++++++--- app/views/account/_login_form.rhtml | 2 +- app/views/account/welcome.rhtml | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 app/views/account/welcome.rhtml diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 90b6612..047fa0b 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -20,9 +20,9 @@ class AccountController < PublicController cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } end go_to_user_initial_page if redirect? - flash[:notice] = _("Logged in successfully") + flash[:notice] = _("Logged in successfully") if redirect? else - flash[:notice] = _('Incorrect username or password') + flash[:notice] = _('Incorrect username or password') if redirect? redirect_to :back if redirect? end end @@ -182,7 +182,14 @@ class AccountController < PublicController if activation && user activation.requestor = user activation.finish - redirect_to :controller => 'profile_editor', :action => 'index', :profile => @enterprise.identifier + redirect_to :action => 'welcome', :enterprise => @enterprise.id + end + end + + def welcome + @enterprise = Enterprise.find(params[:enterprise]) + unless @enterprise.enabled? && logged_in? + redirect_to :action => 'index' end end diff --git a/app/views/account/_login_form.rhtml b/app/views/account/_login_form.rhtml index 1d960be..7234f5e 100644 --- a/app/views/account/_login_form.rhtml +++ b/app/views/account/_login_form.rhtml @@ -1,5 +1,5 @@ <% labelled_form_for :user, @user, - :url => { :controller => 'account', :action => 'login' }, + :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') }, :html => { :help => _('If you are a registered user, enter your username and password to be authenticated.')+'

'+_('To join on this environment, click on "I want to be an user!".')+'

'+_('If you forgot your password, click on "I forgot my password!" link.') } do |f| %> <%= f.text_field :login, diff --git a/app/views/account/welcome.rhtml b/app/views/account/welcome.rhtml new file mode 100644 index 0000000..21956a8 --- /dev/null +++ b/app/views/account/welcome.rhtml @@ -0,0 +1,10 @@ +<% if @enterprise && logged_in? %> +

<%= _('Welcome to %s') % environment.name %>

+ + <%= _('%s was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise') % @enterprise.name %> + + <% button_bar do %> + <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_user.person.identifier %> + <%= button 'forward', _('Go to my enterprise control panel') % @enterprise.name, :action => 'index', :controller => 'profile_editor', :profile => @enterprise.identifier %> + <% end %> +<% end %> -- libgit2 0.21.2