Add hint for using SSO
This commit is contained in:
parent
99a5c7caed
commit
c741634733
@ -256,13 +256,21 @@ func (c *Container) Login(user, password string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ssoSkippedBecausePassword := false
|
||||
for _, flow := range resp.Flows {
|
||||
if flow.Type == "m.login.password" {
|
||||
return c.PasswordLogin(user, password)
|
||||
} else if flow.Type == "m.login.sso" && len(password) == 0 {
|
||||
} else if flow.Type == "m.login.sso" {
|
||||
if len(password) == 0 {
|
||||
return c.SingleSignOn()
|
||||
} else {
|
||||
ssoSkippedBecausePassword = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if ssoSkippedBecausePassword {
|
||||
return fmt.Errorf("password login is not supported\nleave the password field blank to use SSO")
|
||||
}
|
||||
return fmt.Errorf("no supported login flows")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user