Ability to send an email with password when changing a user's password (#3566).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2813 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-07-05 14:06:14 +00:00
parent ad90811e40
commit e54d183d20
3 changed files with 45 additions and 17 deletions
+5 -1
View File
@@ -79,7 +79,11 @@ class UsersController < ApplicationController
# Was the account actived ? (do it before User#save clears the change)
was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
if @user.save
Mailer.deliver_account_activated(@user) if was_activated
if was_activated
Mailer.deliver_account_activated(@user)
elsif @user.active? && params[:send_information] && !params[:password].blank? && @user.auth_source_id.nil?
Mailer.deliver_account_information(@user, params[:password])
end
flash[:notice] = l(:notice_successful_update)
# Give a string to redirect_to otherwise it would use status param as the response code
redirect_to(url_for(:action => 'list', :status => params[:status], :page => params[:page]))
+3
View File
@@ -1,4 +1,7 @@
<% labelled_tabular_form_for :user, @user, :url => { :controller => 'users', :action => "edit", :tab => nil } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<% if @user.active? %>
<%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %>
<% end %>
<% end %>