[add] third-party login

This commit is contained in:
Max 2022-12-16 18:39:47 +08:00
parent a5c0abd7bd
commit d9f7159101
2 changed files with 22 additions and 4 deletions

View file

@ -459,6 +459,11 @@ func processXgen(process *gou.Process) interface{} {
"login": "/api/__yao/login/admin",
"layout": layout,
}
if admin.ThirdPartyLogin != nil && len(admin.ThirdPartyLogin) > 0 {
xgenLogin["admin"]["thirdPartyLogin"] = admin.ThirdPartyLogin
}
}
if user, has := login.Logins["user"]; has {
@ -490,6 +495,10 @@ func processXgen(process *gou.Process) interface{} {
"login": "/api/__yao/login/user",
"layout": layout,
}
if user.ThirdPartyLogin != nil && len(user.ThirdPartyLogin) > 0 {
xgenLogin["user"]["thirdPartyLogin"] = user.ThirdPartyLogin
}
}
xgenSetting := map[string]interface{}{

View file

@ -2,10 +2,11 @@ package login
// DSL the login DSL
type DSL struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Action ActionDSL `json:"action,omitempty"`
Layout LayoutDSL `json:"layout,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Action ActionDSL `json:"action,omitempty"`
Layout LayoutDSL `json:"layout,omitempty"`
ThirdPartyLogin []ThirdPartyLoginDSL `json:"thirdPartyLogin,omitempty"`
}
// ActionDSL the login action DSL
@ -22,3 +23,11 @@ type LayoutDSL struct {
Slogan string `json:"slogan,omitempty"`
Site string `json:"site,omitempty"`
}
// ThirdPartyLoginDSL the thirdparty login url
type ThirdPartyLoginDSL struct {
Title string `json:"title,omitempty"`
Href string `json:"href,omitempty"`
Icon string `json:"icon,omitempty"`
Blank bool `json:"blank,omitempty"`
}