mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-20 03:27:02 -07:00
WIP refactoring login
This commit is contained in:
parent
2e117bea36
commit
61a35c165d
2 changed files with 16 additions and 0 deletions
15
cmd/login.go
15
cmd/login.go
|
|
@ -85,6 +85,11 @@ var loginCmd = &cobra.Command{
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use clients to make SSO buttons that
|
||||||
|
for _, client := range config.Authentication.Clients {
|
||||||
|
MakeButton()
|
||||||
|
}
|
||||||
|
|
||||||
// start the listener
|
// start the listener
|
||||||
err := opaal.Login(&config, &client, provider)
|
err := opaal.Login(&config, &client, provider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -115,3 +120,13 @@ func init() {
|
||||||
loginCmd.MarkFlagsMutuallyExclusive("target.name", "target.index")
|
loginCmd.MarkFlagsMutuallyExclusive("target.name", "target.index")
|
||||||
rootCmd.AddCommand(loginCmd)
|
rootCmd.AddCommand(loginCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MakeButton(url string, text string) string {
|
||||||
|
// check if we have http:// a
|
||||||
|
html := "<input type=\"button\" "
|
||||||
|
html += "class=\"button\" "
|
||||||
|
html += fmt.Sprintf("onclick=\"window.location.href='%s';\" ", url)
|
||||||
|
html += fmt.Sprintf("value=\"%s\"", text)
|
||||||
|
return html
|
||||||
|
// return "<a href=\"" + url + "\"> " + text + "</a>"
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ func (s *Server) StartLogin(buttons string, provider *oidc.IdentityProvider, cli
|
||||||
// add target if query exists
|
// add target if query exists
|
||||||
if r != nil {
|
if r != nil {
|
||||||
target = r.URL.Query().Get("target")
|
target = r.URL.Query().Get("target")
|
||||||
|
sso := r.URL.Query().Get("sso")
|
||||||
}
|
}
|
||||||
// show login page with notice to redirect
|
// show login page with notice to redirect
|
||||||
template, err := gonja.FromFile("pages/index.html")
|
template, err := gonja.FromFile("pages/index.html")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue