mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-09 19:44:32 +01:00
Rely on the lack of ?u to represent public access
also general cleanup
This commit is contained in:
parent
22a2004428
commit
5119818e9d
2 changed files with 6 additions and 10 deletions
|
@ -164,7 +164,7 @@ class AuthRestServlet(RestServlet):
|
||||||
|
|
||||||
html = TERMS_TEMPLATE % {
|
html = TERMS_TEMPLATE % {
|
||||||
'session': session,
|
'session': session,
|
||||||
'terms_url': "%s/_matrix/consent?public=true" % (
|
'terms_url': "%s/_matrix/consent" % (
|
||||||
self.hs.config.public_baseurl,
|
self.hs.config.public_baseurl,
|
||||||
),
|
),
|
||||||
'myurl': "%s/auth/%s/fallback/web" % (
|
'myurl': "%s/auth/%s/fallback/web" % (
|
||||||
|
@ -244,7 +244,7 @@ class AuthRestServlet(RestServlet):
|
||||||
else:
|
else:
|
||||||
html = TERMS_TEMPLATE % {
|
html = TERMS_TEMPLATE % {
|
||||||
'session': session,
|
'session': session,
|
||||||
'terms_url': "%s/_matrix/consent?public=true" % (
|
'terms_url': "%s/_matrix/consent" % (
|
||||||
self.hs.config.public_baseurl,
|
self.hs.config.public_baseurl,
|
||||||
),
|
),
|
||||||
'myurl': "%s/auth/%s/fallback/web" % (
|
'myurl': "%s/auth/%s/fallback/web" % (
|
||||||
|
|
|
@ -30,7 +30,7 @@ from twisted.web.server import NOT_DONE_YET
|
||||||
from synapse.api.errors import NotFoundError, StoreError, SynapseError
|
from synapse.api.errors import NotFoundError, StoreError, SynapseError
|
||||||
from synapse.config import ConfigError
|
from synapse.config import ConfigError
|
||||||
from synapse.http.server import finish_request, wrap_html_request_handler
|
from synapse.http.server import finish_request, wrap_html_request_handler
|
||||||
from synapse.http.servlet import parse_string, parse_boolean
|
from synapse.http.servlet import parse_string
|
||||||
from synapse.types import UserID
|
from synapse.types import UserID
|
||||||
|
|
||||||
# language to use for the templates. TODO: figure this out from Accept-Language
|
# language to use for the templates. TODO: figure this out from Accept-Language
|
||||||
|
@ -137,16 +137,12 @@ class ConsentResource(Resource):
|
||||||
request (twisted.web.http.Request):
|
request (twisted.web.http.Request):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
public_version = parse_boolean(request, "public", default=False)
|
version = parse_string(request, "v", default=self._default_consent_version)
|
||||||
|
username = parse_string(request, "u", required=False, default="")
|
||||||
version = self._default_consent_version
|
|
||||||
username = None
|
|
||||||
userhmac = None
|
userhmac = None
|
||||||
has_consented = False
|
has_consented = False
|
||||||
|
public_version = username != ""
|
||||||
if not public_version:
|
if not public_version:
|
||||||
version = parse_string(request, "v",
|
|
||||||
default=self._default_consent_version)
|
|
||||||
username = parse_string(request, "u", required=True)
|
|
||||||
userhmac = parse_string(request, "h", required=True, encoding=None)
|
userhmac = parse_string(request, "h", required=True, encoding=None)
|
||||||
|
|
||||||
self._check_hash(username, userhmac)
|
self._check_hash(username, userhmac)
|
||||||
|
|
Loading…
Reference in a new issue