mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-22 17:03:49 +08:00
feat: add support for per-account MFA validity period in org setting to reduce repeated prompts (#3917)
This commit is contained in:
@ -58,6 +58,12 @@ func (c *ApiController) MfaSetupInitiate() {
|
||||
return
|
||||
}
|
||||
|
||||
organization, err := object.GetOrganizationByUser(user)
|
||||
if err != nil {
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
mfaProps, err := MfaUtil.Initiate(user.GetId())
|
||||
if err != nil {
|
||||
c.ResponseError(err.Error())
|
||||
@ -66,6 +72,7 @@ func (c *ApiController) MfaSetupInitiate() {
|
||||
|
||||
recoveryCode := uuid.NewString()
|
||||
mfaProps.RecoveryCodes = []string{recoveryCode}
|
||||
mfaProps.MfaRememberInHours = organization.MfaRememberInHours
|
||||
|
||||
resp := mfaProps
|
||||
c.ResponseOk(resp)
|
||||
|
Reference in New Issue
Block a user