fix: SMS verification code URL - replace undefined bricks.app.baseUrl with entire_url template
The send verification code button was sending requests to https://token.opencomputing.cn/undefined/rbac/gen_sms_code.dspy because bricks.app.baseUrl doesn't exist in the bricks framework (it uses baseURI on widgets). Fix: Use Jinja2 entire_url() template function like all other URLs in the file.
This commit is contained in:
parent
ff03efb50a
commit
969a72b528
@ -1,3 +1,4 @@
|
||||
{% set sms_code_url = entire_url('/rbac/gen_sms_code.dspy') %}
|
||||
{
|
||||
"id": "login_window",
|
||||
"widgettype": "PopupWindow",
|
||||
@ -105,7 +106,7 @@
|
||||
"event": "click",
|
||||
"actiontype": "script",
|
||||
"target": "self",
|
||||
"script": "var form=bricks.getWidgetById('phone_form',bricks.app);if(!form){alert('form not found');return;}var vals=form._getValue();var cell=vals.cell_no;if(!cell){alert('请输入手机号');return;}var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(btn&&btn.text_w){btn.text_w.set_otext('发送中...')}fetch(bricks.app.baseUrl+'/rbac/gen_sms_code.dspy?_webbricks_=1&cellphone='+encodeURIComponent(cell)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){form.setValue({codeid:d.data.key});if(btn&&btn.text_w){btn.text_w.set_otext('已发送('+cell+')')}}else{alert(d.data.message);if(btn&&btn.text_w){btn.text_w.set_otext('发送验证码')}}}).catch(function(e){alert('发送失败:'+e);if(btn&&btn.text_w){btn.text_w.set_otext('发送验证码')}})"
|
||||
"script": "var form=bricks.getWidgetById('phone_form',bricks.app);if(!form){alert('form not found');return;}var vals=form._getValue();var cell=vals.cell_no;if(!cell){alert('请输入手机号');return;}var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(btn&&btn.text_w){btn.text_w.set_otext('发送中...')}fetch('{{sms_code_url}}?_webbricks_=1&cellphone='+encodeURIComponent(cell)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){form.setValue({codeid:d.data.key});if(btn&&btn.text_w){btn.text_w.set_otext('已发送('+cell+')')}}else{alert(d.data.message);if(btn&&btn.text_w){btn.text_w.set_otext('发送验证码')}}}).catch(function(e){alert('发送失败:'+e);if(btn&&btn.text_w){btn.text_w.set_otext('发送验证码')}})"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user