Skip to content

Commit 80e9f40

Browse files
authored
fix reveal button password (#51)
1 parent 8a83549 commit 80e9f40

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

tchap/resources/templates/pages/login.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
{% extends "base.html" %}
1010

1111
{% from "components/idp_brand.html" import logo %}
12+
{% from "components/password_field.html" import password_field %}
1213

1314
{% block content %}
1415
<form method="POST" class="flex flex-col gap-10">
@@ -94,11 +95,11 @@ <h1 class="title">{{ _("mas.login.headline") }}</h1>
9495
{% endcall %}
9596
{% endif %}
9697

97-
{% if features.password_login %}
98+
{% if features.password_login %}
9899
{% call(f) field.field(label=_("common.password"), name="password", form_state=form) %}
99-
<input {{ field.attributes(f) }} class="cpd-text-control" type="password" autocomplete="password" required />
100+
<!-- <input {{ field.attributes(f) }} class="cpd-text-control" type="password" autocomplete="password" required /> -->
101+
{{ password_field(input_attributes=field.attributes(f), input_autocomplete="password") }}
100102
{% endcall %}
101-
102103
{% if features.account_recovery %}
103104
{{ button.link_text(text=_("mas.login.forgot_password"), href="/recover", class="self-center") }}
104105
{% endif %}
@@ -121,7 +122,6 @@ <h1 class="title">{{ _("mas.login.headline") }}</h1>
121122
{{ _("mas.login.call_to_register") }}
122123
</p>
123124

124-
125125
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
126126
{{ button.link_text(text=_("action.create_account"), href="/register" ~ params) }}
127127
</div>

tchap/resources/translations/en.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"continue": "Continue",
1212
"@continue": {
13-
"context": "consent.html:57:28-48, form_post.html:25:28-48, pages/consent.html:64:28-48, pages/device_consent.html:124:13-33, pages/device_link.html:40:26-46, pages/login.html:110:30-50, pages/reauth.html:32:28-48, pages/recovery/start.html:38:26-46, pages/register/password.html:74:26-46, pages/register/steps/display_name.html:43: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": "consent.html:57:28-48, form_post.html:25:28-48, pages/consent.html:64:28-48, pages/device_consent.html:124:13-33, pages/device_link.html:40:26-46, pages/login.html:111:30-50, pages/reauth.html:32:28-48, pages/recovery/start.html:38:26-46, pages/register/password.html:77:26-46, pages/register/steps/display_name.html:43: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": {
@@ -79,7 +79,7 @@
7979
},
8080
"email_address": "Email address",
8181
"@email_address": {
82-
"context": "pages/recovery/start.html:34:33-58, pages/register/password.html:38:33-58, pages/upstream_oauth2/do_register.html:120:37-62"
82+
"context": "pages/recovery/start.html:34:33-58, pages/register/password.html:40:33-58, pages/upstream_oauth2/do_register.html:120:37-62"
8383
},
8484
"hide": "",
8585
"@hide": {},
@@ -93,17 +93,17 @@
9393
},
9494
"password": "Password",
9595
"@password": {
96-
"context": "pages/login.html:98:37-57, pages/reauth.html:28:35-55, pages/register/password.html:42:33-53"
96+
"context": "pages/login.html:99:37-57, pages/reauth.html:28:35-55, pages/register/password.html:44:33-53"
9797
},
9898
"password_confirm": "Confirm password",
9999
"@password_confirm": {
100-
"context": "pages/register/password.html:46:33-61"
100+
"context": "pages/register/password.html:49:33-61"
101101
},
102102
"show": "",
103103
"@show": {},
104104
"username": "Username",
105105
"@username": {
106-
"context": "pages/login.html:92:37-57, pages/register/index.html:30:35-55, pages/register/password.html:34:33-53, pages/upstream_oauth2/do_register.html:104:35-55, pages/upstream_oauth2/do_register.html:109:39-59"
106+
"context": "pages/login.html:93:37-57, pages/register/index.html:30:35-55, pages/register/password.html:36:33-53, pages/upstream_oauth2/do_register.html:104:35-55, pages/upstream_oauth2/do_register.html:109:39-59"
107107
}
108108
},
109109
"error": {
@@ -423,34 +423,34 @@
423423
"login": {
424424
"call_to_register": "Don't have an account yet?",
425425
"@call_to_register": {
426-
"context": "pages/login.html:121:13-44"
426+
"context": "pages/login.html:122:13-44"
427427
},
428428
"continue_with_provider": "Continue with %(provider)s",
429429
"@continue_with_provider": {
430-
"context": "pages/login.html:66:11-63, pages/register/index.html:53:15-67",
430+
"context": "pages/login.html:67:11-63, pages/register/index.html:53:15-67",
431431
"description": "Button to log in with an upstream provider"
432432
},
433433
"description": "Please sign in to continue:",
434434
"@description": {
435-
"context": "pages/login.html:30:34-60"
435+
"context": "pages/login.html:31:34-60"
436436
},
437437
"forgot_password": "Forgot password?",
438438
"@forgot_password": {
439-
"context": "pages/login.html:103:35-65",
439+
"context": "pages/login.html:104:35-65",
440440
"description": "On the login page, link to the account recovery process"
441441
},
442442
"headline": "Sign in",
443443
"@headline": {
444-
"context": "pages/login.html:29:31-54"
444+
"context": "pages/login.html:30:31-54"
445445
},
446446
"link": {
447447
"description": "Linking your <span class=\"break-keep text-links\">%(provider)s</span> account",
448448
"@description": {
449-
"context": "pages/login.html:25:29-75"
449+
"context": "pages/login.html:26:29-75"
450450
},
451451
"headline": "Sign in to link",
452452
"@headline": {
453-
"context": "pages/login.html:23:31-59"
453+
"context": "pages/login.html:24:31-59"
454454
}
455455
},
456456
"no_login_methods": "No login methods available.",
@@ -459,7 +459,7 @@
459459
},
460460
"username_or_email": "Username or Email",
461461
"@username_or_email": {
462-
"context": "pages/login.html:88:37-69"
462+
"context": "pages/login.html:89:37-69"
463463
}
464464
},
465465
"navbar": {
@@ -617,7 +617,7 @@
617617
"register": {
618618
"call_to_login": "Already have an account?",
619619
"@call_to_login": {
620-
"context": "pages/register/index.html:59:35-66, pages/register/password.html:77:33-64",
620+
"context": "pages/register/index.html:59:35-66, pages/register/password.html:80:33-64",
621621
"description": "Displayed on the registration page to suggest to log in instead"
622622
},
623623
"continue_with_email": "Continue with email address",
@@ -631,12 +631,12 @@
631631
},
632632
"heading": "Create an account",
633633
"@heading": {
634-
"context": "pages/register/index.html:21:29-69, pages/register/password.html:18:27-67"
634+
"context": "pages/register/index.html:21:29-69, pages/register/password.html:20:27-67"
635635
}
636636
},
637637
"terms_of_service": "I agree to the <a href=\"%s\" data-kind=\"primary\" class=\"cpd-link\">Terms and Conditions</a>",
638638
"@terms_of_service": {
639-
"context": "pages/register/password.html:51:35-95, pages/upstream_oauth2/do_register.html:185:35-95"
639+
"context": "pages/register/password.html:54:35-95, pages/upstream_oauth2/do_register.html:185:35-95"
640640
}
641641
},
642642
"registration_token": {

templates/components/password_field.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
{% import "components/field.html" as field %}
33

44
{% macro password_field(input_attributes, input_autocomplete="password", class="") %}
5-
<div class="password-field-container">
6-
<input {{ input_attributes }} class="cpd-text-control" type="password" autocomplete="{{input_autocomplete}}" required />
5+
<!-- use @vector-im/compound-web/src/components/Form/Controls/Action/Action.module.css -->
6+
<div class="password-field-container container">
7+
<input {{ input_attributes }} class="cpd-text-control control" type="password" autocomplete="{{input_autocomplete}}" required />
78
<button type="button" class="action" onclick="togglePasswordVisibility(this)">
89
{{ icon.visibility_off() }}
910
</button>

0 commit comments

Comments
 (0)