Skip to content

Commit 472feea

Browse files
authored
fix(login): Enter submits the form; ProConnect button no longer acts as submit (#67)
1 parent e5374d9 commit 472feea

File tree

2 files changed

+35
-59
lines changed

2 files changed

+35
-59
lines changed

tchap/resources/templates/pages/login.html

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,30 @@
1212
{% from "components/password_field.html" import password_field %}
1313

1414
{% block content %}
15-
<form method="POST" class="flex flex-col gap-10">
16-
<header class="page-heading">
17-
<!--
18-
<div class="icon">
19-
{{ icon.user_profile_solid() }}
15+
16+
17+
<header class="page-heading">
18+
{% if next and next.kind == "link_upstream" %}
19+
<div class="header">
20+
<h1 class="title">{{ _("mas.login.link.headline") }}</h1>
21+
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
22+
<p class="text">{{ _("mas.login.link.description", provider=name) }}</p>
2023
</div>
21-
-->
22-
{% if next and next.kind == "link_upstream" %}
23-
<div class="header">
24-
<h1 class="title">{{ _("mas.login.link.headline") }}</h1>
25-
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
26-
<p class="text">{{ _("mas.login.link.description", provider=name) }}</p>
27-
</div>
28-
{% else %}
29-
<div class="header">
30-
<h1 class="title">{{ _("mas.login.headline") }}</h1>
31-
<!-- <p class="text">{{ _("mas.login.description") }}</p> -->
32-
</div>
33-
{% endif %}
34-
</header>
24+
{% else %}
25+
<div class="header">
26+
<h1 class="title">{{ _("mas.login.headline") }}</h1>
27+
<!-- <p class="text">{{ _("mas.login.description") }}</p> -->
28+
</div>
29+
{% endif %}
30+
</header>
3531

36-
<!-- #tchap# -->
37-
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
38-
{% for provider in providers %}
32+
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
33+
{% for provider in providers %}
3934
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
4035

4136
<!-- #tchap# add .lasuite class to add lasuite fonts -->
4237
<div class="cpd-form-root lasuite">
43-
<button class="proconnect-button" onclick="window.location.href = '{{ ('/upstream/authorize/' ~ provider.id ~ params) | prefix_url }}';return false;">
38+
<button type="button" class="proconnect-button" onclick="window.location.href = '{{ ('/upstream/authorize/' ~ provider.id ~ params) | prefix_url }}'">
4439
<span class="proconnect-sr-only">S'identifier avec ProConnect</span>
4540
</button>
4641
<p>
@@ -55,26 +50,11 @@ <h1 class="title">{{ _("mas.login.headline") }}</h1>
5550
</a>
5651
</p>
5752
</div>
58-
{% endfor %}
59-
<!-- #tchap# end -->
60-
<!--
61-
{% if providers %}
62-
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
63-
{% for provider in providers %}
64-
{% set name = provider.human_name or (provider.issuer | simplify_url(keep_path=True)) or provider.id %}
65-
66-
<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 }}">
67-
{{ logo(provider.brand_name) }}
68-
{{ _("mas.login.continue_with_provider", provider=name) }}
69-
</a>
70-
{% endfor %}
71-
{% endif %}
72-
-->
73-
74-
75-
{{ field.separator() }}
76-
53+
{% endfor %}
54+
<!-- #tchap# end -->
7755

56+
{{ field.separator() }}
57+
<form method="POST" class="flex flex-col gap-10">
7858
<div class="cpd-form-root">
7959
{% if form.errors is not empty %}
8060
{% for error in form.errors %}
@@ -111,10 +91,6 @@ <h1 class="title">{{ _("mas.login.headline") }}</h1>
11191
{% if features.password_login %}
11292
{{ button.button(text=_("action.continue")) }}
11393
{% endif %}
114-
115-
116-
117-
11894
</div>
11995

12096
{% if (not next or next.kind != "link_upstream") and features.password_registration %}

tchap/resources/translations/en.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
},
1111
"continue": "Continue",
1212
"@continue": {
13-
"context": "form_post.html:25:28-48, pages/consent.html:74:28-48, pages/device_consent.html:124:13-33, pages/device_link.html:40:26-46, pages/login.html:112:30-50, pages/reauth.html:32:28-48, pages/recovery/start.html:38:26-46, pages/register/password.html:80:26-46, pages/register/steps/display_name.html:45:28-48, pages/register/steps/registration_token.html:41:28-48, pages/register/steps/verify_email.html:51:26-46, pages/sso.html:37:28-48"
13+
"context": "form_post.html:25:28-48, pages/consent.html:74:28-48, pages/device_consent.html:124:13-33, pages/device_link.html:40:26-46, pages/login.html:92:30-50, pages/reauth.html:32:28-48, pages/recovery/start.html:38:26-46, pages/register/password.html:80:26-46, pages/register/steps/display_name.html:45:28-48, pages/register/steps/registration_token.html:41:28-48, pages/register/steps/verify_email.html:51:26-46, pages/sso.html:37:28-48"
1414
},
1515
"create_account": "Create Account",
1616
"@create_account": {
17-
"context": "pages/login.html:127:33-59, pages/register/index.html:20:29-55, pages/upstream_oauth2/do_register.html:197:26-52"
17+
"context": "pages/login.html:103:33-59, pages/register/index.html:20:29-55, pages/upstream_oauth2/do_register.html:197:26-52"
1818
},
1919
"sign_in": "Sign in",
2020
"@sign_in": {
@@ -93,7 +93,7 @@
9393
},
9494
"password": "Password",
9595
"@password": {
96-
"context": "pages/login.html:100:37-57, pages/reauth.html:28:35-55, pages/register/password.html:47:33-53"
96+
"context": "pages/login.html:80:37-57, pages/reauth.html:28:35-55, pages/register/password.html:47:33-53"
9797
},
9898
"password_confirm": "Confirm password",
9999
"@password_confirm": {
@@ -103,7 +103,7 @@
103103
"@show": {},
104104
"username": "Username",
105105
"@username": {
106-
"context": "pages/login.html:94:37-57, pages/register/index.html:59:35-55, pages/register/password.html:38:45-65, pages/upstream_oauth2/do_register.html:104:35-55, pages/upstream_oauth2/do_register.html:109:39-59"
106+
"context": "pages/login.html:74:37-57, pages/register/index.html:59:35-55, pages/register/password.html:38:45-65, pages/upstream_oauth2/do_register.html:104:35-55, pages/upstream_oauth2/do_register.html:109:39-59"
107107
}
108108
},
109109
"create_account": "",
@@ -425,43 +425,43 @@
425425
"login": {
426426
"call_to_register": "Don't have an account yet?",
427427
"@call_to_register": {
428-
"context": "pages/login.html:123:13-44"
428+
"context": "pages/login.html:99:13-44"
429429
},
430430
"continue_with_provider": "Continue with %(provider)s",
431431
"@continue_with_provider": {
432-
"context": "pages/login.html:68:11-63, pages/register/index.html:82:23-75",
432+
"context": "pages/register/index.html:82:23-75",
433433
"description": "Button to log in with an upstream provider"
434434
},
435435
"description": "Please sign in to continue:",
436436
"@description": {
437-
"context": "pages/login.html:31:34-60"
437+
"context": "pages/login.html:27:32-58"
438438
},
439439
"forgot_password": "Forgot password?",
440440
"@forgot_password": {
441-
"context": "pages/login.html:105:35-65",
441+
"context": "pages/login.html:85:35-65",
442442
"description": "On the login page, link to the account recovery process"
443443
},
444444
"headline": "Sign in",
445445
"@headline": {
446-
"context": "pages/login.html:30:31-54"
446+
"context": "pages/login.html:26:29-52"
447447
},
448448
"link": {
449449
"description": "Linking your <span class=\"break-keep text-links\">%(provider)s</span> account",
450450
"@description": {
451-
"context": "pages/login.html:26:29-75"
451+
"context": "pages/login.html:22:27-73"
452452
},
453453
"headline": "Sign in to link",
454454
"@headline": {
455-
"context": "pages/login.html:24:31-59"
455+
"context": "pages/login.html:20:29-57"
456456
}
457457
},
458458
"no_login_methods": "No login methods available.",
459459
"@no_login_methods": {
460-
"context": "pages/login.html:133:11-42"
460+
"context": "pages/login.html:109:11-42"
461461
},
462462
"username_or_email": "Username or Email",
463463
"@username_or_email": {
464-
"context": "pages/login.html:90:37-69"
464+
"context": "pages/login.html:70:37-69"
465465
}
466466
},
467467
"navbar": {

0 commit comments

Comments
 (0)