From 389527296e02ab5ae205e22a9544589f6121b64d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 6 Dec 2015 20:46:26 +0000 Subject: Prevent admins from sending themselves their own password (#21436). Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@14966 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/users_controller.rb | 2 +- app/views/users/_general.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9ce80111a..33699325b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -143,7 +143,7 @@ class UsersController < ApplicationController if was_activated Mailer.account_activated(@user).deliver - elsif @user.active? && params[:send_information] && @user.password.present? && @user.auth_source_id.nil? + elsif @user.active? && params[:send_information] && @user.password.present? && @user.auth_source_id.nil? && @user != User.current Mailer.account_information(@user, @user.password).deliver end diff --git a/app/views/users/_general.html.erb b/app/views/users/_general.html.erb index 0daa421c7..7d84c0ced 100644 --- a/app/views/users/_general.html.erb +++ b/app/views/users/_general.html.erb @@ -1,6 +1,6 @@ <%= labelled_form_for @user do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> - <% if @user.active? && email_delivery_enabled? -%> + <% if @user.active? && email_delivery_enabled? && @user != User.current -%>

<% end -%>

<%= submit_tag l(:button_save) %>

-- cgit v1.2.3