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

Function SettingsTwoFactorRecoveryCodes

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

Source from the content-addressed store, hash-verified

472}
473
474func SettingsTwoFactorRecoveryCodes(c *context.Context) {
475 if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) {
476 c.NotFound()
477 return
478 }
479
480 c.Title("settings.two_factor_recovery_codes_title")
481 c.PageIs("SettingsSecurity")
482
483 recoveryCodes, err := database.GetRecoveryCodesByUserID(c.UserID())
484 if err != nil {
485 c.Errorf(err, "get recovery codes by user ID")
486 return
487 }
488 c.Data["RecoveryCodes"] = recoveryCodes
489
490 c.Success(tmplUserSettingsTwoFactorRecoveryCodes)
491}
492
493func SettingsTwoFactorRecoveryCodesPost(c *context.Context) {
494 if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) {

Callers

nothing calls this directly

Calls 9

GetRecoveryCodesByUserIDFunction · 0.92
IsEnabledMethod · 0.80
TwoFactorsMethod · 0.80
TitleMethod · 0.80
PageIsMethod · 0.80
UserIDMethod · 0.80
SuccessMethod · 0.80
NotFoundMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected