mirror of https://github.com/authelia/authelia.git
fix(handlers): disabling 2fa methods may result in a bad ux (#7360)
This fixes an issue where disabled 2FA methods may appear to users as available. Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
This commit is contained in:
parent
2eaef3ca80
commit
010b7fa5e3
internal/handlers
|
@ -57,6 +57,18 @@ func UserInfoPOST(ctx *middlewares.AutheliaCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
if ctx.Configuration.TOTP.Disable {
|
||||
userInfo.HasTOTP = false
|
||||
}
|
||||
|
||||
if ctx.Configuration.WebAuthn.Disable {
|
||||
userInfo.HasWebAuthn = false
|
||||
}
|
||||
|
||||
if ctx.Configuration.DuoAPI.Disable {
|
||||
userInfo.HasDuo = false
|
||||
}
|
||||
|
||||
userInfo.DisplayName = userSession.DisplayName
|
||||
|
||||
err = ctx.SetJSONBody(userInfo)
|
||||
|
|
|
@ -189,7 +189,7 @@ func TestUserInfoEndpoint_SetDefaultMethod(t *testing.T) {
|
|||
Method: "totp",
|
||||
HasTOTP: false,
|
||||
HasWebAuthn: false,
|
||||
HasDuo: true,
|
||||
HasDuo: false,
|
||||
},
|
||||
config: &schema.Configuration{DuoAPI: schema.DuoAPI{Disable: true}},
|
||||
loadErr: nil,
|
||||
|
@ -205,7 +205,7 @@ func TestUserInfoEndpoint_SetDefaultMethod(t *testing.T) {
|
|||
},
|
||||
api: &model.UserInfo{
|
||||
Method: "webauthn",
|
||||
HasTOTP: true,
|
||||
HasTOTP: false,
|
||||
HasWebAuthn: true,
|
||||
HasDuo: true,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue