Selaa lähdekoodia

[fix] [user] new password

version-14
Rushabh Mehta 10 vuotta sitten
vanhempi
commit
e474b36be0
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. +7
    -7
      frappe/core/doctype/user/user.py

+ 7
- 7
frappe/core/doctype/user/user.py Näytä tiedosto

@@ -16,6 +16,7 @@ STANDARD_USERS = ("Guest", "Administrator")
from frappe.model.document import Document from frappe.model.document import Document


class User(Document): class User(Document):
__new_password = None
def autoname(self): def autoname(self):
"""set name as email id""" """set name as email id"""
if self.name not in STANDARD_USERS: if self.name not in STANDARD_USERS:
@@ -24,6 +25,11 @@ class User(Document):


def validate(self): def validate(self):
self.in_insert = self.get("__islocal") 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: if self.name not in STANDARD_USERS:
self.validate_email_type(self.email) self.validate_email_type(self.email)
self.add_system_manager_role() self.add_system_manager_role()
@@ -76,10 +82,9 @@ class User(Document):
def on_update(self): def on_update(self):
# clear new password # clear new password
self.share_with_self() self.share_with_self()
new_password = self.clear_new_password()
clear_notifications(user=self.name) clear_notifications(user=self.name)
frappe.clear_cache(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): def share_with_self(self):
if self.user_type=="System User": if self.user_type=="System User":
@@ -97,11 +102,6 @@ class User(Document):
else: else:
frappe.throw(_("Sorry! Sharing with Website User is prohibited.")) 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): def send_password_notifcation(self, new_password):
try: try:
if self.in_insert: if self.in_insert:


Ladataan…
Peruuta
Tallenna