fix to login

This commit is contained in:
Rushabh Mehta 2013-03-19 14:35:19 +05:30
parent a9bf6061cd
commit aa8ef4cc14
2 changed files with 5 additions and 4 deletions

View file

@ -88,6 +88,7 @@ def get_html(doc, doclist):
return html
def make_doctype_structure(doctype):
"""wip"""
s = []
fields = doctype.get({"doctype":"DocField"})

View file

@ -134,13 +134,13 @@ def uploadfile():
json.dumps(ret))
@webnotes.whitelist(allow_guest=True)
def reset_password():
def reset_password(user):
from webnotes.model.code import get_obj
from webnotes.utils import random_string
user = webnotes.form_dict.get('user', '')
if user in ["demo@erpnext.com", "Administrator"]:
webnotes.msgprint("Not allowed", raise_exception=1)
return "Not allowed"
if webnotes.conn.sql("""select name from tabProfile where name=%s""", user):
new_password = random_string(8)
@ -151,9 +151,9 @@ def reset_password():
webnotes.session["user"] = "Administrator"
profile = get_obj("Profile", user)
profile.password_reset_mail(new_password)
webnotes.msgprint("Password has been reset and sent to your email id.")
return "Password has been reset and sent to your email id."
else:
webnotes.msgprint("No such user (%s)" % user)
return "No such user (%s)" % user
def handle():