##// END OF EJS Templates
Let the mailer set the email content (#21421)....
Jean-Philippe Lang -
r14885:a47eab886835
parent child
Show More
@@ -73,12 +73,7 class AccountController < ApplicationController
73 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
73 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
74 if @user.save
74 if @user.save
75 @token.destroy
75 @token.destroy
76 Mailer.security_notification(@user,
76 Mailer.password_updated(@user)
77 message: :mail_body_security_notification_change,
78 field: :field_password,
79 title: :button_change_password,
80 url: {controller: 'my', action: 'password'}
81 ).deliver
82 flash[:notice] = l(:notice_account_password_updated)
77 flash[:notice] = l(:notice_account_password_updated)
83 redirect_to signin_path
78 redirect_to signin_path
84 return
79 return
@@ -105,12 +105,7 class MyController < ApplicationController
105 if @user.save
105 if @user.save
106 # The session token was destroyed by the password change, generate a new one
106 # The session token was destroyed by the password change, generate a new one
107 session[:tk] = @user.generate_session_token
107 session[:tk] = @user.generate_session_token
108 Mailer.security_notification(@user,
108 Mailer.password_updated(@user)
109 message: :mail_body_security_notification_change,
110 field: :field_password,
111 title: :button_change_password,
112 url: {controller: 'my', action: 'password'}
113 ).deliver
114 flash[:notice] = l(:notice_account_password_updated)
109 flash[:notice] = l(:notice_account_password_updated)
115 redirect_to my_account_path
110 redirect_to my_account_path
116 end
111 end
@@ -310,6 +310,16 class Mailer < ActionMailer::Base
310 :subject => l(:mail_subject_lost_password, Setting.app_title)
310 :subject => l(:mail_subject_lost_password, Setting.app_title)
311 end
311 end
312
312
313 # Notifies user that his password was updated
314 def self.password_updated(user)
315 Mailer.security_notification(user,
316 message: :mail_body_security_notification_change,
317 field: :field_password,
318 title: :button_change_password,
319 url: {controller: 'my', action: 'password'}
320 ).deliver
321 end
322
313 def register(token)
323 def register(token)
314 set_language_if_valid(token.user.language)
324 set_language_if_valid(token.user.language)
315 @token = token
325 @token = token
General Comments 0
You need to be logged in to leave comments. Login now