diff --git a/renovation_core/utils/auth.py b/renovation_core/utils/auth.py index 3ed2468..6f5a396 100644 --- a/renovation_core/utils/auth.py +++ b/renovation_core/utils/auth.py @@ -10,8 +10,6 @@ from frappe.utils.password import check_password, passlibctx, update_password from renovation_core.utils import update_http_response -from .sms_setting import send_sms - @frappe.whitelist(allow_guest=True) def generate_otp(medium="sms", medium_id=None, sms_hash=None, purpose="login", lang=None): @@ -35,7 +33,7 @@ def generate_otp(medium="sms", medium_id=None, sms_hash=None, purpose="login", l 2. Accept-Language header or from frappe.session.user (done by frappe ) 3. is user exists from medium_id (email or mobile) ie user.lang (ie Guest Users) """ - + from .sms_setting import send_sms if medium not in ("sms", "email"): frappe.throw(_("medium can only be 'sms' or 'email'")) diff --git a/renovation_core/utils/sms_setting.py b/renovation_core/utils/sms_setting.py index 5dffad8..6953fd1 100644 --- a/renovation_core/utils/sms_setting.py +++ b/renovation_core/utils/sms_setting.py @@ -60,8 +60,10 @@ def send_sms(receiver_list, msg, sender_name='', success_msg=True, provider=None def get_default_sms_providers(): - system_settings = frappe.get_single("System Settings") - return system_settings.sms_providers or [frappe._dict(provider=system_settings.sms_settings)] + system_settings = frappe.get_single("System Settings") + return system_settings.sms_providers or ( + [frappe._dict(provider=system_settings.sms_settings)] if hasattr(system_settings, + "sms_settings") else []) def send_via_gateway(arg, providers):