Project

General

Profile

Patch #21436 ยป 0001-Prevent-admins-from-sending-themselves-their-own-pas.patch

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

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>
    (1-1/1)