Isolate more the mfa service (#16925)
* Isolate more the mfa service * Simplifing the mfa service * Removing channels and adding waitgroup * Migrating mfa service to regular errors * Fixing tests * i18n extract * Addressing PR review comments * Removing unneeded struct
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7585e16d84
Коммит
5f190b5624
@@ -188,10 +188,13 @@ func (a *App) CheckUserMfa(user *model.User, token string) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
mfaService := mfa.New(a, a.Srv().Store)
|
||||
ok, err := mfaService.ValidateToken(user.MfaSecret, token)
|
||||
if !*a.Config().ServiceSettings.EnableMultifactorAuthentication {
|
||||
return model.NewAppError("CheckUserMfa", "mfa.mfa_disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
ok, err := mfa.New(a.Srv().Store.User()).ValidateToken(user.MfaSecret, token)
|
||||
if err != nil {
|
||||
return err
|
||||
return model.NewAppError("CheckUserMfa", "mfa.validate_token.authenticate.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !ok {
|
||||
|
||||
Ссылка в новой задаче
Block a user