Block unregistered users from resetting password
This commit is contained in:
parent
7627a051da
commit
d99d252a70
1 changed files with 5 additions and 2 deletions
|
|
@ -149,11 +149,14 @@ class Profile:
|
|||
pwd = self.get_random_password()
|
||||
|
||||
# get profile
|
||||
profile = webnotes.conn.sql("SELECT name, email, first_name, last_name FROM tabProfile WHERE name=%s OR email=%s",(self.name, self.name))
|
||||
profile = webnotes.conn.sql("SELECT name, email, first_name, last_name, registered FROM tabProfile WHERE name=%s OR email=%s",(self.name, self.name))
|
||||
|
||||
if not profile:
|
||||
raise Exception, "Profile %s not found" % self.name
|
||||
|
||||
elif not profile[0][4]:
|
||||
# if an unregistered user tries to reset password
|
||||
raise Exception, "You cannot reset your password as you have not completed registration. You need to complete registration using the link provided in the email."
|
||||
|
||||
# update tab Profile
|
||||
webnotes.conn.sql("UPDATE tabProfile SET password=password(%s) WHERE name=%s", (pwd, profile[0][0]))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue