Skip to content

Commit

Permalink
Merge pull request YaoApp#295 from trheyi/main
Browse files Browse the repository at this point in the history
[add] third-party login
  • Loading branch information
trheyi authored Dec 16, 2022
2 parents a5c0abd + d9f7159 commit 33e0f52
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
9 changes: 9 additions & 0 deletions widgets/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{}{
Expand Down
17 changes: 13 additions & 4 deletions widgets/login/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"`
}

0 comments on commit 33e0f52

Please sign in to comment.