Skip to content

Commit 702a876

Browse files
authored

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

routers/web/passkey.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package web
5+
6+
import (
7+
"net/http"
8+
9+
"code.gitea.io/gitea/modules/context"
10+
"code.gitea.io/gitea/modules/setting"
11+
)
12+
13+
type passkeyEndpointsType struct {
14+
Enroll string `json:"enroll"`
15+
Manage string `json:"manage"`
16+
}
17+
18+
func passkeyEndpoints(ctx *context.Context) {
19+
url := setting.AppURL + "user/settings/security"
20+
ctx.JSON(http.StatusOK, passkeyEndpointsType{
21+
Enroll: url,
22+
Manage: url,
23+
})
24+
}

routers/web/web.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ func registerRoutes(m *web.Route) {
473473
m.Get("/change-password", func(ctx *context.Context) {
474474
ctx.Redirect(setting.AppSubURL + "/user/settings/account")
475475
})
476+
m.Get("/passkey-endpoints", passkeyEndpoints)
476477
m.Methods("GET, HEAD", "/*", public.FileHandlerFunc())
477478
}, optionsCorsHandler())
478479

0 commit comments

Comments
 (0)