mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 01:25:44 +03:00
Support multiple login flows when deciding how to login. Updated cmdclient and spec. Webclient doesn't need updating for this.
This commit is contained in:
parent
52cfdfd5f1
commit
8d7d251c35
3 changed files with 23 additions and 16 deletions
|
@ -225,8 +225,13 @@ class SynapseCmd(cmd.Cmd):
|
||||||
json_res = yield self.http_client.do_request("GET", url)
|
json_res = yield self.http_client.do_request("GET", url)
|
||||||
print json_res
|
print json_res
|
||||||
|
|
||||||
if ("type" not in json_res or "m.login.password" != json_res["type"] or
|
if "flows" not in json_res:
|
||||||
"stages" in json_res):
|
print "Failed to find any login flows."
|
||||||
|
defer.returnValue(False)
|
||||||
|
|
||||||
|
flow = json_res["flows"][0] # assume first is the one we want.
|
||||||
|
if ("type" not in flow or "m.login.password" != flow["type"] or
|
||||||
|
"stages" in flow):
|
||||||
fallback_url = self._url() + "/login/fallback"
|
fallback_url = self._url() + "/login/fallback"
|
||||||
print ("Unable to login via the command line client. Please visit "
|
print ("Unable to login via the command line client. Please visit "
|
||||||
"%s to login." % fallback_url)
|
"%s to login." % fallback_url)
|
||||||
|
|
|
@ -230,19 +230,21 @@ with all the valid login flows when requested::
|
||||||
The client can login via 3 paths: 1a and 1b, 2a and 2b, or 3. The client should
|
The client can login via 3 paths: 1a and 1b, 2a and 2b, or 3. The client should
|
||||||
select one of these paths.
|
select one of these paths.
|
||||||
|
|
||||||
[
|
{
|
||||||
{
|
"flows": [
|
||||||
"type": "<login type1a>",
|
{
|
||||||
"stages": [ "<login type 1a>", "<login type 1b>" ]
|
"type": "<login type1a>",
|
||||||
},
|
"stages": [ "<login type 1a>", "<login type 1b>" ]
|
||||||
{
|
},
|
||||||
"type": "<login type2a>",
|
{
|
||||||
"stages": [ "<login type 2a>", "<login type 2b>" ]
|
"type": "<login type2a>",
|
||||||
},
|
"stages": [ "<login type 2a>", "<login type 2b>" ]
|
||||||
{
|
},
|
||||||
"type": "<login type3>"
|
{
|
||||||
}
|
"type": "<login type3>"
|
||||||
]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
After the login is completed, the client's fully-qualified user ID and a new access
|
After the login is completed, the client's fully-qualified user ID and a new access
|
||||||
token MUST be returned::
|
token MUST be returned::
|
||||||
|
|
|
@ -27,7 +27,7 @@ class LoginRestServlet(RestServlet):
|
||||||
PASS_TYPE = "m.login.password"
|
PASS_TYPE = "m.login.password"
|
||||||
|
|
||||||
def on_GET(self, request):
|
def on_GET(self, request):
|
||||||
return (200, {"type": LoginRestServlet.PASS_TYPE})
|
return (200, {"flows": [{"type": LoginRestServlet.PASS_TYPE}]})
|
||||||
|
|
||||||
def on_OPTIONS(self, request):
|
def on_OPTIONS(self, request):
|
||||||
return (200, {})
|
return (200, {})
|
||||||
|
|
Loading…
Reference in a new issue