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

Function SettingsTwoFactorDisable

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

Source from the content-addressed store, hash-verified

506}
507
508func SettingsTwoFactorDisable(c *context.Context) {
509 if !database.Handle.TwoFactors().IsEnabled(c.Req.Context(), c.User.ID) {
510 c.NotFound()
511 return
512 }
513
514 if err := database.DeleteTwoFactor(c.UserID()); err != nil {
515 c.Errorf(err, "delete two factor")
516 return
517 }
518
519 c.Flash.Success(c.Tr("settings.two_factor_disable_success"))
520 c.JSONSuccess(map[string]any{
521 "redirect": conf.Server.Subpath + "/user/settings/security",
522 })
523}
524
525func SettingsRepos(c *context.Context) {
526 c.Title("settings.repos")

Callers

nothing calls this directly

Calls 9

DeleteTwoFactorFunction · 0.92
IsEnabledMethod · 0.80
TwoFactorsMethod · 0.80
UserIDMethod · 0.80
SuccessMethod · 0.80
TrMethod · 0.80
JSONSuccessMethod · 0.80
NotFoundMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected