Commit a193058c473f17613895777310ef68a30fcdb63b

Authored by MoisesMachado
1 parent c22b2322

ActionItem603: added welcome page

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/branches/0.10.x@2383 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/account_controller.rb
... ... @@ -20,9 +20,9 @@ class AccountController < PublicController
20 20 cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
21 21 end
22 22 go_to_user_initial_page if redirect?
23   - flash[:notice] = _("Logged in successfully")
  23 + flash[:notice] = _("Logged in successfully") if redirect?
24 24 else
25   - flash[:notice] = _('Incorrect username or password')
  25 + flash[:notice] = _('Incorrect username or password') if redirect?
26 26 redirect_to :back if redirect?
27 27 end
28 28 end
... ... @@ -182,7 +182,14 @@ class AccountController < PublicController
182 182 if activation && user
183 183 activation.requestor = user
184 184 activation.finish
185   - redirect_to :controller => 'profile_editor', :action => 'index', :profile => @enterprise.identifier
  185 + redirect_to :action => 'welcome', :enterprise => @enterprise.id
  186 + end
  187 + end
  188 +
  189 + def welcome
  190 + @enterprise = Enterprise.find(params[:enterprise])
  191 + unless @enterprise.enabled? && logged_in?
  192 + redirect_to :action => 'index'
186 193 end
187 194 end
188 195  
... ...
app/views/account/_login_form.rhtml
1 1 <% labelled_form_for :user, @user,
2   - :url => { :controller => 'account', :action => 'login' },
  2 + :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') },
3 3 :html => { :help => _('If you are a registered user, enter your username and password to be authenticated.')+'<p/>'+_('To join on this environment, click on "<b>I want to be an user!</b>".')+'<p/>'+_('If you forgot your password, click on "<b>I forgot my password!</b>" link.') } do |f| %>
4 4  
5 5 <%= f.text_field :login,
... ...
app/views/account/welcome.rhtml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<% if @enterprise && logged_in? %>
  2 + <h1><%= _('Welcome to %s') % environment.name %></h1>
  3 +
  4 + <%= _('%s was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise') % @enterprise.name %>
  5 +
  6 + <% button_bar do %>
  7 + <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_user.person.identifier %>
  8 + <%= button 'forward', _('Go to my enterprise control panel') % @enterprise.name, :action => 'index', :controller => 'profile_editor', :profile => @enterprise.identifier %>
  9 + <% end %>
  10 +<% end %>
... ...