Skip to content

Commit

Permalink
Fix super admin binding and login
Browse files Browse the repository at this point in the history
  • Loading branch information
gps949 committed Sep 1, 2023
1 parent 6903223 commit 4bcc9dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controller/cockpit.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,19 @@ func (c *Cockpit) RegisterAdmin(
c.doAPIResponse(w, "", "ok")
return
} else { // 注册请求
if c.author == nil {
//if c.author == nil {
wconfig := &webauthn.Config{
RPDisplayName: "蜃境网络", // Display Name for your site
RPID: r.Host, // Generally the FQDN for your site
RPOrigins: []string{"https://" + r.Host}, //[]string{"https://" + serverURL}, // The origin URLs allowed for WebAuthn requests
RPOrigins: r.Header["Origin"], //[]string{"https://" + serverURL}, // The origin URLs allowed for WebAuthn requests
}
webAuthor, err := webauthn.New(wconfig)
if err != nil {
c.doAPIResponse(w, "创建WebAuthn验证器失败", nil)
return
}
c.author = webAuthor
}
//}
options, webAuthSession, err := c.author.BeginRegistration(c.superAdmin)
c.authCache.Set("MirageSuperAdmin", webAuthSession, 5*time.Minute)
if err != nil {
Expand Down Expand Up @@ -403,19 +403,19 @@ func (c *Cockpit) Login(
http.SetCookie(w, authCookie)
c.doAPIResponse(w, "", "ok")
} else { // 登录请求
if c.author == nil {
//if c.author == nil {
wconfig := &webauthn.Config{
RPDisplayName: "蜃境网络", // Display Name for your site
RPID: r.Host, // Generally the FQDN for your site
RPOrigins: []string{"https://" + r.Host}, //[]string{"https://" + serverURL}, // The origin URLs allowed for WebAuthn requests
RPOrigins: r.Header["Origin"], //[]string{"https://" + serverURL}, // The origin URLs allowed for WebAuthn requests
}
webAuthor, err := webauthn.New(wconfig)
if err != nil {
c.doAPIResponse(w, "创建WebAuthn验证器失败", nil)
return
}
c.author = webAuthor
}
//}
options, session, err := c.author.BeginLogin(c.superAdmin)
if err != nil {
c.doAPIResponse(w, "启动超管登录失败", nil)
Expand Down

0 comments on commit 4bcc9dc

Please sign in to comment.