From 969a72b52868d4dfac55eac663b991a836c05750 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 28 May 2026 18:24:39 +0800 Subject: [PATCH] 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. --- wwwroot/user/login.ui | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wwwroot/user/login.ui b/wwwroot/user/login.ui index c735737..08e93fb 100644 --- a/wwwroot/user/login.ui +++ b/wwwroot/user/login.ui @@ -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('发送验证码')}})" } ] }