Skip to content

Commit

Permalink
Merge pull request #169 from mila-iqia/display-api-key
Browse files Browse the repository at this point in the history
Display Clockwork API key in settings web page
  • Loading branch information
soline-b authored Oct 19, 2023
2 parents 71d4d8f + c7c85c1 commit aa4009c
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 193 deletions.
4 changes: 0 additions & 4 deletions clockwork_web/browser_routes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ def route_index():
# Display the user's settings as HTML
return render_template_with_user_settings(
"settings.html",
mila_email_username=current_user.mila_email_username,
clockwork_api_key=current_user.clockwork_api_key,
cc_account_username=current_user.cc_account_username,
cc_account_update_key=current_user.cc_account_update_key,
available_languages=get_config("translation.available_languages"),
previous_request_args=previous_request_args,
)
Expand Down
4 changes: 3 additions & 1 deletion clockwork_web/rest_routes/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def decorated(*args, **kwargs):
return jsonify("Database error."), 500

D_user = L[0]
if secrets.compare_digest(D_user["clockwork_api_key"], auth["password"]):
if D_user["clockwork_api_key"] is not None and secrets.compare_digest(
D_user["clockwork_api_key"], auth["password"]
):
g.current_user_with_rest_auth = D_user
return f(*args, **kwargs)
# no need to manually clear `g.current_user_with_rest_auth` because
Expand Down
Loading

0 comments on commit aa4009c

Please sign in to comment.