Skip to content

Commit 8faceac

Browse files
committed
Disable unnecessary OpenID elements
This mod fixes disabling unnecessary OpenID elements. Related: go-gitea#13129 Author-Change-Id: IB#1115256
1 parent b7c6457 commit 8faceac

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

routers/web/web.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,15 @@ func RegisterRoutes(m *web.Route) {
277277
m.Get("/{provider}", auth.SignInOAuth)
278278
m.Get("/{provider}/callback", auth.SignInOAuthCallback)
279279
})
280-
m.Get("/link_account", auth.LinkAccount)
281-
m.Post("/link_account_signin", bindIgnErr(forms.SignInForm{}), auth.LinkAccountPostSignIn)
282-
m.Post("/link_account_signup", bindIgnErr(forms.RegisterForm{}), auth.LinkAccountPostRegister)
280+
m.Group("/link_account", func() {
281+
m.Get("", auth.LinkAccount)
282+
}, openIDSignInEnabled)
283+
m.Group("/link_account_signin", func() {
284+
m.Post("", bindIgnErr(forms.SignInForm{}), auth.LinkAccountPostSignIn)
285+
}, openIDSignInEnabled)
286+
m.Group("/link_account_signup", func() {
287+
m.Post("", bindIgnErr(forms.RegisterForm{}), auth.LinkAccountPostRegister)
288+
}, openIDSignUpEnabled)
283289
m.Group("/two_factor", func() {
284290
m.Get("", auth.TwoFactor)
285291
m.Post("", bindIgnErr(forms.TwoFactorAuthForm{}), auth.TwoFactorPost)
@@ -342,7 +348,9 @@ func RegisterRoutes(m *web.Route) {
342348
m.Post("/delete", security.DeleteOpenID)
343349
m.Post("/toggle_visibility", security.ToggleOpenIDVisibility)
344350
}, openIDSignInEnabled)
345-
m.Post("/account_link", security.DeleteAccountLink)
351+
m.Group("/account_link", func() {
352+
m.Post("", security.DeleteAccountLink)
353+
}, openIDSignInEnabled)
346354
})
347355
m.Group("/applications/oauth2", func() {
348356
m.Get("/{id}", user_setting.OAuth2ApplicationShow)

0 commit comments

Comments
 (0)