GH-11465 Migrate User.UpdateMfaSecret to Sync by default (#11496)
* GH-11465 Migrate User.UpdateMfaSecret to Sync by default * GH-11465 make mfa call async * GH-11465 return *model.AppError directly
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
eea8df75b0
Коммит
b55b9a3d97
@@ -302,16 +302,14 @@ func (us SqlUserStore) UpdateAuthData(userId string, service string, authData *s
|
||||
return userId, nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) UpdateMfaSecret(userId, secret string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
updateAt := model.GetMillis()
|
||||
func (us SqlUserStore) UpdateMfaSecret(userId, secret string) *model.AppError {
|
||||
updateAt := model.GetMillis()
|
||||
|
||||
if _, err := us.GetMaster().Exec("UPDATE Users SET MfaSecret = :Secret, UpdateAt = :UpdateAt WHERE Id = :UserId", map[string]interface{}{"Secret": secret, "UpdateAt": updateAt, "UserId": userId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.UpdateMfaSecret", "store.sql_user.update_mfa_secret.app_error", nil, "id="+userId+", "+err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
result.Data = userId
|
||||
}
|
||||
})
|
||||
if _, err := us.GetMaster().Exec("UPDATE Users SET MfaSecret = :Secret, UpdateAt = :UpdateAt WHERE Id = :UserId", map[string]interface{}{"Secret": secret, "UpdateAt": updateAt, "UserId": userId}); err != nil {
|
||||
return model.NewAppError("SqlUserStore.UpdateMfaSecret", "store.sql_user.update_mfa_secret.app_error", nil, "id="+userId+", "+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) UpdateMfaActive(userId string, active bool) store.StoreChannel {
|
||||
|
||||
Ссылка в новой задаче
Block a user