feat(api): reset password check for SMTP

This commit is contained in:
Taha Yassine Kraiem 2021-12-03 11:19:15 +01:00
parent 15581360e3
commit 63bc981dc8
2 changed files with 5 additions and 3 deletions

View file

@ -1,5 +1,5 @@
from chalicelib.utils import email_helper, captcha, helper
from chalicelib.core import users
from chalicelib.utils import email_helper, captcha, helper
def reset(data):
@ -10,7 +10,8 @@ def reset(data):
return {"errors": ["Invalid captcha."]}
if "email" not in data:
return {"errors": ["email not found in body"]}
if not helper.has_smtp():
return {"errors": ["no SMTP configuration found"]}
a_users = users.get_by_email_only(data["email"])
if len(a_users) > 1:
print(f"multiple users found for [{data['email']}] please contact our support")

View file

@ -10,7 +10,8 @@ def reset(data):
return {"errors": ["Invalid captcha."]}
if "email" not in data:
return {"errors": ["email not found in body"]}
if not helper.has_smtp():
return {"errors": ["no SMTP configuration found"]}
a_user = users.get_by_email_only(data["email"])
if a_user is not None:
# ---FOR SSO