mirror of
https://github.com/MirageNetwork/MirageServer.git
synced 2025-09-26 20:41:34 +08:00
Fix super admin binding and login
This commit is contained in:
@@ -343,11 +343,11 @@ func (c *Cockpit) RegisterAdmin(
|
|||||||
c.doAPIResponse(w, "", "ok")
|
c.doAPIResponse(w, "", "ok")
|
||||||
return
|
return
|
||||||
} else { // 注册请求
|
} else { // 注册请求
|
||||||
if c.author == nil {
|
//if c.author == nil {
|
||||||
wconfig := &webauthn.Config{
|
wconfig := &webauthn.Config{
|
||||||
RPDisplayName: "蜃境网络", // Display Name for your site
|
RPDisplayName: "蜃境网络", // Display Name for your site
|
||||||
RPID: r.Host, // Generally the FQDN 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)
|
webAuthor, err := webauthn.New(wconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -355,7 +355,7 @@ func (c *Cockpit) RegisterAdmin(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.author = webAuthor
|
c.author = webAuthor
|
||||||
}
|
//}
|
||||||
options, webAuthSession, err := c.author.BeginRegistration(c.superAdmin)
|
options, webAuthSession, err := c.author.BeginRegistration(c.superAdmin)
|
||||||
c.authCache.Set("MirageSuperAdmin", webAuthSession, 5*time.Minute)
|
c.authCache.Set("MirageSuperAdmin", webAuthSession, 5*time.Minute)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -403,11 +403,11 @@ func (c *Cockpit) Login(
|
|||||||
http.SetCookie(w, authCookie)
|
http.SetCookie(w, authCookie)
|
||||||
c.doAPIResponse(w, "", "ok")
|
c.doAPIResponse(w, "", "ok")
|
||||||
} else { // 登录请求
|
} else { // 登录请求
|
||||||
if c.author == nil {
|
//if c.author == nil {
|
||||||
wconfig := &webauthn.Config{
|
wconfig := &webauthn.Config{
|
||||||
RPDisplayName: "蜃境网络", // Display Name for your site
|
RPDisplayName: "蜃境网络", // Display Name for your site
|
||||||
RPID: r.Host, // Generally the FQDN 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)
|
webAuthor, err := webauthn.New(wconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -415,7 +415,7 @@ func (c *Cockpit) Login(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.author = webAuthor
|
c.author = webAuthor
|
||||||
}
|
//}
|
||||||
options, session, err := c.author.BeginLogin(c.superAdmin)
|
options, session, err := c.author.BeginLogin(c.superAdmin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.doAPIResponse(w, "启动超管登录失败", nil)
|
c.doAPIResponse(w, "启动超管登录失败", nil)
|
||||||
|
Reference in New Issue
Block a user