0001-Prevent-admins-from-sending-themselves-their-own-pas.patch

Jan from Planio www.plan.io, 2015-12-06 17:25

Download (1.62 KB)

View differences:

app/controllers/users_controller.rb
143 143

  
144 144
      if was_activated
145 145
        Mailer.account_activated(@user).deliver
146
      elsif @user.active? && params[:send_information] && @user.password.present? && @user.auth_source_id.nil?
146
      elsif @user.active? && params[:send_information] && @user.password.present? && @user.auth_source_id.nil? && @user != User.current
147 147
        Mailer.account_information(@user, @user.password).deliver
148 148
      end
149 149

  
app/views/users/_general.html.erb
1 1
<%= labelled_form_for @user do |f| %>
2 2
  <%= render :partial => 'form', :locals => { :f => f } %>
3
  <% if @user.active? && email_delivery_enabled? -%>
3
  <% if @user.active? && email_delivery_enabled? && @user != User.current -%>
4 4
    <p><label><%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %></label></p>
5 5
  <% end -%>
6 6
  <p><%= submit_tag l(:button_save) %></p>
7
-