Improve detecting login flows supported by homeserver
This commit is contained in:
parent
f0a40ec20b
commit
180ecc36cc
@ -252,13 +252,14 @@ func (c *Container) Login(user, password string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(resp.Flows) == 1 && resp.Flows[0].Type == "m.login.password" {
|
for _, flow := range resp.Flows {
|
||||||
|
if flow.Type == "m.login.password" {
|
||||||
return c.PasswordLogin(user, password)
|
return c.PasswordLogin(user, password)
|
||||||
} else if len(resp.Flows) == 2 && resp.Flows[0].Type == "m.login.sso" && resp.Flows[1].Type == "m.login.token" {
|
} else if flow.Type == "m.login.sso" {
|
||||||
return c.SingleSignOn()
|
return c.SingleSignOn()
|
||||||
} else {
|
|
||||||
return fmt.Errorf("no supported login flows")
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return fmt.Errorf("no supported login flows")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logout revokes the access token, stops the syncer and calls the OnLogout() method of the UI.
|
// Logout revokes the access token, stops the syncer and calls the OnLogout() method of the UI.
|
||||||
|
Loading…
Reference in New Issue
Block a user