Skip to content

Commit e93a40f

Browse files
committed
修复异地登录自动验证提交两次的问题
1 parent 73057dd commit e93a40f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

internal/web/helpers/user_must_auth.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
216216
this.login(action)
217217
return false
218218
} else {
219-
// TODO 考虑IP变化时也需要验证,主要是考虑被反向代理的情形
220-
action.RedirectURL("/login/validate?from=" + url.QueryEscape(action.Request.URL.String()))
221-
return false
219+
if !lists.ContainsString([]string{"/messages/badge", "/dns/tasks/check", "/clusters/tasks/check"}, action.Request.URL.Path) {
220+
// TODO 考虑IP变化时也需要验证,主要是考虑被反向代理的情形
221+
action.RedirectURL("/login/validate?from=" + url.QueryEscape(action.Request.URL.String()))
222+
return false
223+
}
222224
}
223225
}
224226
}

web/views/@default/login/validate.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Tea.context(function () {
1010

1111
this.$post("$")
1212
.params({localSid: sid, "ip": ip})
13-
.post()
1413
.success(function (resp) {
1514
if (!resp.data.isOk) {
1615
window.location = "/logout"
@@ -28,7 +27,7 @@ Tea.context(function () {
2827
} else {
2928
window.location = "/dashboard"
3029
}
31-
})
30+
}, 100)
3231
})
3332
})
3433
})

0 commit comments

Comments
 (0)