Skip to content

Commit

Permalink
Reduce initial number of owners and specify default domain
Browse files Browse the repository at this point in the history
The new client won't show up on the dashboard if the user's domain isn't in the 'allowed domains'. This may not be preferred behaviour, but short term I've worked around it by defaulting 'allowed domains' to the user's.
  • Loading branch information
jonodrew committed Jun 21, 2024
1 parent 2b6b107 commit e941ea5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ <h2 class="govuk-heading-l">Dashboard</h2>
<h2 class="govuk-heading-l">Applications</h2>
<div>
{%- if allowed_apps %}
<p>{{ allowed_apps }}</p>
{%- for a in allowed_apps %}
<p>{{ a }}</p>
{%- set app = allowed_apps[a] %}
{%- if app["name"] and ((app["sign_in_url"] and app["dashboard_display"]) or app["can_manage"]) %}
<div>
Expand Down
6 changes: 3 additions & 3 deletions templates/new-client.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ <h1 class="govuk-fieldset__heading">
<input class="govuk-input govuk-!-width-two-thirds" id="sign-in-url" name="sign_in_url" type="text">
</div>
<div class="govuk-form-group">
<label class="govuk-label" for="owners">
Owner(s). On the next page, you'll be able to add more owners.
<label class="govuk-label" for="owner">
Initial owner. On the next page, you'll be able to add more owners.
</label>
<input class="govuk-input govuk-input--width-10" id="owners" name="owners" type="text">
<input class="govuk-input" id="owner" name="owner" type="text">
</div>
</fieldset>
<div class="govuk-button-group">
Expand Down
3 changes: 2 additions & 1 deletion wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1412,9 +1412,10 @@ def new_client():
client_id = client_secret_dict.get("client_id")
client_secret = client_secret_dict.get("client_secret")
request_dict = request.form.to_dict()
user_domain = request_dict.get("owner").split("@")[1]
sso_oidc.save_client(
filename=f"{request_dict['app_url']}_{uuid.uuid4().hex}.json",
client={"secret": client_secret, **request_dict},
client={"secret": client_secret, "allowed_domains": [user_domain], **request_dict},
client_id=client_id
)
return redirect(f"/view?client_id={client_id}")
Expand Down

0 comments on commit e941ea5

Please sign in to comment.