From 63bc981dc8418e2e0779341f891180dea98c492c Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 3 Dec 2021 11:19:15 +0100 Subject: [PATCH] feat(api): reset password check for SMTP --- api/chalicelib/core/reset_password.py | 5 +++-- ee/api/chalicelib/core/reset_password.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/chalicelib/core/reset_password.py b/api/chalicelib/core/reset_password.py index 0b7302d5d..e4ee1b61d 100644 --- a/api/chalicelib/core/reset_password.py +++ b/api/chalicelib/core/reset_password.py @@ -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") diff --git a/ee/api/chalicelib/core/reset_password.py b/ee/api/chalicelib/core/reset_password.py index c1ac1fe65..fe8cdd15c 100644 --- a/ee/api/chalicelib/core/reset_password.py +++ b/ee/api/chalicelib/core/reset_password.py @@ -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