From 7ff842d58fdbe1d7f4e0f09e195409851215a8c2 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 17 Jun 2019 15:10:38 +0530 Subject: [PATCH 1/2] fix: Do not send password update notification to disabled users --- frappe/core/doctype/user/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 5b6e6c27a8..af9077b19c 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -208,7 +208,7 @@ class User(Document): if frappe.session.user != 'Guest': msgprint(_("Welcome email sent")) return - else: + elif self.enabled: self.email_new_password(new_password) except frappe.OutgoingEmailError: From cb34f7c05275bd17ee53511c14dc19e5bb575a5a Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 17 Jun 2019 15:18:56 +0530 Subject: [PATCH 2/2] fix: Do not send mail --- frappe/core/doctype/user/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index af9077b19c..116da2102f 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -155,7 +155,7 @@ class User(Document): if new_password and not self.flags.in_insert: _update_password(user=self.name, pwd=new_password, logout_all_sessions=self.logout_all_sessions) - if self.send_password_update_notification: + if self.send_password_update_notification and self.enabled: self.password_update_mail(new_password) frappe.msgprint(_("New password emailed")) @@ -208,7 +208,7 @@ class User(Document): if frappe.session.user != 'Guest': msgprint(_("Welcome email sent")) return - elif self.enabled: + else: self.email_new_password(new_password) except frappe.OutgoingEmailError: