From e474b36be0f419b396d99c766b9ff9be1c30d83f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 6 May 2015 11:07:45 +0530 Subject: [PATCH] [fix] [user] new password --- frappe/core/doctype/user/user.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index b42530986d..2982e461bb 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -16,6 +16,7 @@ STANDARD_USERS = ("Guest", "Administrator") from frappe.model.document import Document class User(Document): + __new_password = None def autoname(self): """set name as email id""" if self.name not in STANDARD_USERS: @@ -24,6 +25,11 @@ class User(Document): def validate(self): self.in_insert = self.get("__islocal") + + # clear new password + self.__new_password = self.new_password + self.new_password = "" + if self.name not in STANDARD_USERS: self.validate_email_type(self.email) self.add_system_manager_role() @@ -76,10 +82,9 @@ class User(Document): def on_update(self): # clear new password self.share_with_self() - new_password = self.clear_new_password() clear_notifications(user=self.name) frappe.clear_cache(user=self.name) - self.send_password_notifcation(new_password) + self.send_password_notifcation(self.__new_password) def share_with_self(self): if self.user_type=="System User": @@ -97,11 +102,6 @@ class User(Document): else: frappe.throw(_("Sorry! Sharing with Website User is prohibited.")) - def clear_new_password(self): - new_password = self.new_password - self.db_set("new_password", "") - return new_password - def send_password_notifcation(self, new_password): try: if self.in_insert: