mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
check admins' two-factor requirements in the disable API as well
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -100,6 +100,13 @@ func disableAdmin2FA(w http.ResponseWriter, r *http.Request) {
|
||||
sendAPIResponse(w, r, err, "", getRespStatus(err))
|
||||
return
|
||||
}
|
||||
if admin.Username == claims.Username {
|
||||
if admin.Filters.RequireTwoFactor {
|
||||
err := util.NewValidationError("two-factor authentication must be enabled")
|
||||
sendAPIResponse(w, r, err, "", getRespStatus(err))
|
||||
return
|
||||
}
|
||||
}
|
||||
admin.Filters.RecoveryCodes = nil
|
||||
admin.Filters.TOTPConfig = dataprovider.AdminTOTPConfig{
|
||||
Enabled: false,
|
||||
|
||||
Reference in New Issue
Block a user