diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2021-02-03 20:31:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 20:31:23 +0000 |
commit | e288499c60802c8c563ef59884c0c040d630e924 (patch) | |
tree | 6148ec828b35cc47074211ba6e2cb684daea23f2 /synapse/handlers/auth.py | |
parent | Add debug for OIDC flow (#9307) (diff) | |
download | synapse-e288499c60802c8c563ef59884c0c040d630e924.tar.xz |
Social login UI polish (#9301)
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r-- | synapse/handlers/auth.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index a19c556437..648fe91f53 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -1472,10 +1472,22 @@ class AuthHandler(BaseHandler): # Remove the query parameters from the redirect URL to get a shorter version of # it. This is only to display a human-readable URL in the template, but not the # URL we redirect users to. - redirect_url_no_params = client_redirect_url.split("?")[0] + url_parts = urllib.parse.urlsplit(client_redirect_url) + + if url_parts.scheme == "https": + # for an https uri, just show the netloc (ie, the hostname. Specifically, + # the bit between "//" and "/"; this includes any potential + # "username:password@" prefix.) + display_url = url_parts.netloc + else: + # for other uris, strip the query-params (including the login token) and + # fragment. + display_url = urllib.parse.urlunsplit( + (url_parts.scheme, url_parts.netloc, url_parts.path, "", "") + ) html = self._sso_redirect_confirm_template.render( - display_url=redirect_url_no_params, + display_url=display_url, redirect_url=redirect_url, server_name=self._server_name, new_user=new_user, |