feat: Add hooks for custom SMS and OTP SMS sending (#33444)
* feat: add hook for custom SMS OTP sender (mobile_otp_sms_sender) in 2FA * [ADD]: Hooks for send SMS * [fix]: Hook changed to send token. * chore: remove unnecessary comment
This commit is contained in:
parent
79018e8dab
commit
7df795cf99
2 changed files with 9 additions and 0 deletions
|
|
@ -78,6 +78,10 @@ def send_sms(receiver_list, msg, sender_name="", success_msg=True):
|
|||
"success_msg": success_msg,
|
||||
}
|
||||
|
||||
send_sms_hook_methods = frappe.get_hooks("send_sms")
|
||||
if send_sms_hook_methods:
|
||||
return frappe.get_attr(send_sms_hook_methods[-1])(receiver_list, msg, sender_name, success_msg)
|
||||
|
||||
if frappe.db.get_single_value("SMS Settings", "sms_gateway_url"):
|
||||
send_via_gateway(arg)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -302,6 +302,11 @@ def get_link_for_qrcode(user, totp_uri):
|
|||
|
||||
def send_token_via_sms(otpsecret, token=None, phone_no=None):
|
||||
"""Send token as sms to user."""
|
||||
|
||||
send_token_hook_methods = frappe.get_hooks("send_token_via_sms")
|
||||
if send_token_hook_methods:
|
||||
return frappe.get_attr(send_token_hook_methods[-1])(otpsecret, token, phone_no)
|
||||
|
||||
try:
|
||||
from frappe.core.doctype.sms_settings.sms_settings import send_request
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue