mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
Fix GetCaptchaStatus() crash if not logged in
This commit is contained in:
@ -980,16 +980,20 @@ func (c *ApiController) GetCaptchaStatus() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
failedSigninLimit, _, err := object.GetFailedSigninConfigByUser(user)
|
captchaEnabled := false
|
||||||
if err != nil {
|
if user != nil {
|
||||||
c.ResponseError(err.Error())
|
var failedSigninLimit int
|
||||||
return
|
failedSigninLimit, _, err = object.GetFailedSigninConfigByUser(user)
|
||||||
|
if err != nil {
|
||||||
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if user.SigninWrongTimes >= failedSigninLimit {
|
||||||
|
captchaEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var captchaEnabled bool
|
|
||||||
if user != nil && user.SigninWrongTimes >= failedSigninLimit {
|
|
||||||
captchaEnabled = true
|
|
||||||
}
|
|
||||||
c.ResponseOk(captchaEnabled)
|
c.ResponseOk(captchaEnabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ class ProviderTable extends React.Component {
|
|||||||
title: i18next.t("application:Rule"),
|
title: i18next.t("application:Rule"),
|
||||||
dataIndex: "rule",
|
dataIndex: "rule",
|
||||||
key: "rule",
|
key: "rule",
|
||||||
width: "100px",
|
width: "120px",
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
if (record.provider?.type === "Google") {
|
if (record.provider?.type === "Google") {
|
||||||
if (text === "None") {
|
if (text === "None") {
|
||||||
|
Reference in New Issue
Block a user