@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
@token.destroy
- Mailer.security_notification(@user,
- message: :mail_body_security_notification_change,
- field: :field_password,
- title: :button_change_password,
- url: {controller: 'my', action: 'password'}
- ).deliver
+ Mailer.password_updated(@user)
flash[:notice] = l(:notice_account_password_updated)
redirect_to signin_path
return
if @user.save
# The session token was destroyed by the password change, generate a new one
session[:tk] = @user.generate_session_token
- Mailer.security_notification(@user,
- message: :mail_body_security_notification_change,
- field: :field_password,
- title: :button_change_password,
- url: {controller: 'my', action: 'password'}
- ).deliver
+ Mailer.password_updated(@user)
flash[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path
end
:subject => l(:mail_subject_lost_password, Setting.app_title)
end
+ # Notifies user that his password was updated
+ def self.password_updated(user)
+ Mailer.security_notification(user,
+ message: :mail_body_security_notification_change,
+ field: :field_password,
+ title: :button_change_password,
+ url: {controller: 'my', action: 'password'}
+ ).deliver
+ end
+
def register(token)
set_language_if_valid(token.user.language)
@token = token