Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 6f986e1

Browse files
committed
Fix the login template in case no human_name was set on the provider
1 parent 7d7bcfe commit 6f986e1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/handlers/src/views/login.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ mod test {
385385
&state.clock,
386386
UpstreamOAuthProviderParams {
387387
issuer: "https://second.com/".to_owned(),
388-
human_name: Some("Second Ltd.".to_owned()),
388+
human_name: None,
389389
brand_name: None,
390390
scope: [OPENID].into_iter().collect(),
391391
token_endpoint_auth_method: OAuthClientAuthenticationMethod::None,
@@ -413,7 +413,7 @@ mod test {
413413
assert!(response
414414
.body()
415415
.contains(&escape_html(&first_provider_login.path_and_query())));
416-
assert!(response.body().contains(&escape_html("Second Ltd.")));
416+
assert!(response.body().contains(&escape_html("second.com")));
417417
assert!(response
418418
.body()
419419
.contains(&escape_html(&second_provider_login.path_and_query())));

templates/pages/login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{% if next and next.kind == "link_upstream" %}
3030
<div class="header">
3131
<h1 class="title">{{ _("mas.login.link.headline") }}</h1>
32-
{% set name = provider.human_name | default(provider.issuer | simplify_url(keep_path=True)) | default(provider.id) %}
32+
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
3333
<p class="text">{{ _("mas.login.link.description", provider=name) }}</p>
3434
</div>
3535
{% else %}
@@ -81,7 +81,7 @@ <h1 class="title">{{ _("mas.login.headline") }}</h1>
8181

8282
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
8383
{% for provider in providers %}
84-
{% set name = provider.human_name | default(provider.issuer | simplify_url(keep_path=True)) | default(provider.id) %}
84+
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
8585
<a class="cpd-button {%- if provider.brand_name %} has-icon {%- endif %}" data-kind="secondary" data-size="lg" href="{{ ('/upstream/authorize/' ~ provider.id ~ params) | prefix_url }}">
8686
{{ logo(provider.brand_name) }}
8787
{{ _("mas.login.continue_with_provider", provider=name) }}

0 commit comments

Comments
 (0)