Skip to content

Commit

Permalink
making callback method dynamic to update users
Browse files Browse the repository at this point in the history
  • Loading branch information
julius-heitkoetter committed Nov 28, 2023
1 parent 705ae2f commit e074b94
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions a2rchi/interfaces/chat_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def __init__(self, app, **configs):

if self.GOOGLE_LOGIN:
google_callback = partial(
FlaskAppWrapper.callback,
self.callback,
get_provider_cfg=self.get_google_provider_cfg,
client=self.google_client,
client_id=GOOGLE_CLIENT_ID,
Expand All @@ -471,7 +471,7 @@ def __init__(self, app, **configs):

if self.MIT_LOGIN:
mit_callback = partial(
FlaskAppWrapper.callback,
self.callback,
get_provider_cfg=self.get_mit_provider_cfg,
client=self.mit_client,
client_id=MIT_CLIENT_ID,
Expand Down Expand Up @@ -674,8 +674,7 @@ def login(self):

return redirect(request_uri)

@staticmethod
def callback(get_provider_cfg, client, client_id, client_secret, valid_user_emails):
def callback(self, get_provider_cfg, client, client_id, client_secret, valid_user_emails):
# get authorization code provider sent back
code = request.args.get("code")

Expand Down Expand Up @@ -715,7 +714,7 @@ def callback(get_provider_cfg, client, client_id, client_secret, valid_user_emai
return "User email not available or not verified by provider.", 400

# if owner of this application has not green-light email; reject user
if user_email not in valid_user_emails:
if user_email not in self.VALID_USER_EMAILS:
return "User email not authorized for this application.", 401

# TODO: we could send them to a different landing page w/a link back to index
Expand Down

0 comments on commit e074b94

Please sign in to comment.