Skip to content

Commit

Permalink
Handle CORS for GetValidated3pidServlet (#342)
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Kozimor p1996k@gmail.com
  • Loading branch information
PiotrKozimor authored Jun 7, 2021
1 parent ea85cb0 commit af32e62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/342.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle CORS for `GetValidated3pidServlet`. Endpoint `/3pid/getValidated3pid` returns valid CORS headers.
7 changes: 6 additions & 1 deletion sydent/http/servlets/getvalidated3pidservlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from sydent.db.valsession import ThreePidValSessionStore
from sydent.http.auth import authV2
from sydent.http.servlets import get_args, jsonwrap
from sydent.http.servlets import get_args, jsonwrap, send_cors
from sydent.util.stringutils import is_valid_client_secret
from sydent.validators import (
IncorrectClientSecretException,
Expand All @@ -38,6 +38,7 @@ def __init__(self, syd, require_auth=False):

@jsonwrap
def render_GET(self, request):
send_cors(request)
if self.require_auth:
authV2(self.sydent, request)

Expand Down Expand Up @@ -79,3 +80,7 @@ def render_GET(self, request):
}

return {"medium": s.medium, "address": s.address, "validated_at": s.mtime}

def render_OPTIONS(self, request):
send_cors(request)
return b""

0 comments on commit af32e62

Please sign in to comment.