瀏覽代碼

[fix] patch

version-14
Rushabh Mehta 9 年之前
父節點
當前提交
93e3ac2770
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. +2
    -1
      frappe/core/doctype/user/user.py
  2. +1
    -1
      frappe/patches/v6_15/set_username.py

+ 2
- 1
frappe/core/doctype/user/user.py 查看文件

@@ -316,7 +316,8 @@ class User(Document):


# should be made up of characters, numbers and underscore only # should be made up of characters, numbers and underscore only
if not re.match(r"^[\w]+$", self.username): if not re.match(r"^[\w]+$", self.username):
frappe.throw(_("Username should not contain any special characters other than letters, numbers and underscore"))
frappe.msgprint(_("Username should not contain any special characters other than letters, numbers and underscore"))
self.username = ""


def suggest_username(self): def suggest_username(self):
def _check_suggestion(suggestion): def _check_suggestion(suggestion):


+ 1
- 1
frappe/patches/v6_15/set_username.py 查看文件

@@ -7,7 +7,7 @@ def execute():
users = frappe.db.sql_list("""select name from `tabUser` order by if(user_type='System User', 0, 1)""") users = frappe.db.sql_list("""select name from `tabUser` order by if(user_type='System User', 0, 1)""")
for name in users: for name in users:
user = frappe.get_doc("User", name) user = frappe.get_doc("User", name)
if user.username:
if user.username or not user.first_name:
continue continue


username = user.suggest_username() username = user.suggest_username()


Loading…
取消
儲存