(c *context.Context)
| 491 | } |
| 492 | |
| 493 | func SettingsTwoFactorRecoveryCodesPost(c *context.Context) { |
| 494 | if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) { |
| 495 | c.NotFound() |
| 496 | return |
| 497 | } |
| 498 | |
| 499 | if err := database.RegenerateRecoveryCodes(c.UserID()); err != nil { |
| 500 | c.Flash.Error(c.Tr("settings.two_factor_regenerate_recovery_codes_error", err)) |
| 501 | } else { |
| 502 | c.Flash.Success(c.Tr("settings.two_factor_regenerate_recovery_codes_success")) |
| 503 | } |
| 504 | |
| 505 | c.RedirectSubpath("/user/settings/security/two_factor_recovery_codes") |
| 506 | } |
| 507 | |
| 508 | func SettingsTwoFactorDisable(c *context.Context) { |
| 509 | if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) { |
nothing calls this directly
no test coverage detected