Commit e791cacefee98bf9035c1176e2973fbd6e5f7012
1 parent
7bac7ef7
Exists in
master
and in
23 other branches
LoginBlock must have the same conditions as login view
If a plugin doesn't allow registration, the signup button won't appear If a plugin doesn't allow password recovery, the "Forgot my password" button won't appear Also added notices after redirections (ActionItem2423)
Showing
2 changed files
with
14 additions
and
6 deletions
Show diff stats
app/controllers/public/account_controller.rb
| ... | ... | @@ -59,6 +59,7 @@ class AccountController < ApplicationController |
| 59 | 59 | def signup |
| 60 | 60 | if @plugins.dispatch(:allow_user_registration).include?(false) |
| 61 | 61 | redirect_back_or_default(:controller => 'home') |
| 62 | + session[:notice] = _("This environment doesn't allow user registration.") | |
| 62 | 63 | end |
| 63 | 64 | |
| 64 | 65 | @invitation_code = params[:invitation_code] |
| ... | ... | @@ -132,6 +133,7 @@ class AccountController < ApplicationController |
| 132 | 133 | def forgot_password |
| 133 | 134 | if @plugins.dispatch(:allow_password_recovery).include?(false) |
| 134 | 135 | redirect_back_or_default(:controller => 'home') |
| 136 | + session[:notice] = _("This environment doesn't allow password recovery.") | |
| 135 | 137 | end |
| 136 | 138 | @change_password = ChangePassword.new(params[:change_password]) |
| 137 | 139 | ... | ... |
app/views/account/login_block.rhtml
| ... | ... | @@ -16,18 +16,24 @@ |
| 16 | 16 | |
| 17 | 17 | <%= f.password_field :password %> |
| 18 | 18 | |
| 19 | + <%= @plugins.dispatch(:login_extra_contents).collect { |content| instance_eval(&content) }.join("") %> | |
| 20 | + | |
| 19 | 21 | <% button_bar do %> |
| 20 | 22 | <%= submit_button( 'login', _('Log in') )%> |
| 21 | - <%= link_to content_tag( 'span', _('New user') ), | |
| 22 | - { :controller => 'account', :action => 'signup' }, | |
| 23 | - :class => 'button with-text icon-add' %> | |
| 23 | + <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> | |
| 24 | + <%= link_to content_tag( 'span', _('New user') ), | |
| 25 | + { :controller => 'account', :action => 'signup' }, | |
| 26 | + :class => 'button with-text icon-add' %> | |
| 27 | + <% end %> | |
| 24 | 28 | <% end %> |
| 25 | 29 | |
| 26 | 30 | <% end %> |
| 27 | 31 | |
| 28 | - <p class="forgot-passwd"> | |
| 29 | - <%= link_to _("I forgot my password!"), :controller => 'account', :action => 'forgot_password' %> | |
| 30 | - </p> | |
| 32 | + <% unless @plugins.dispatch(:allow_password_recovery).include?(false) %> | |
| 33 | + <p class="forgot-passwd"> | |
| 34 | + <%= link_to _("I forgot my password!"), :controller => 'account', :action => 'forgot_password' %> | |
| 35 | + </p> | |
| 36 | + <% end %> | |
| 31 | 37 | |
| 32 | 38 | </div> |
| 33 | 39 | ... | ... |