MCPcopy Create free account
hub / github.com/gogs/gogs / SettingsTwoFactorRecoveryCodesPost

Function SettingsTwoFactorRecoveryCodesPost

internal/route/user/setting.go:493–506  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

491}
492
493func 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
508func SettingsTwoFactorDisable(c *context.Context) {
509 if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) {

Callers

nothing calls this directly

Calls 9

RegenerateRecoveryCodesFunction · 0.92
IsEnabledMethod · 0.80
TwoFactorsMethod · 0.80
UserIDMethod · 0.80
TrMethod · 0.80
SuccessMethod · 0.80
RedirectSubpathMethod · 0.80
NotFoundMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected