Skip to content

Commit 6646397

Browse files
authored
remove mxid input from import data page (#46)
* do not display mxid field * fix translate
1 parent 5f7ff0b commit 6646397

File tree

2 files changed

+218
-22
lines changed

2 files changed

+218
-22
lines changed
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
{#
2+
Copyright 2024, 2025 New Vector Ltd.
3+
Copyright 2022-2024 The Matrix.org Foundation C.I.C.
4+
5+
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
6+
Please see LICENSE files in the repository root for full details.
7+
-#}
8+
9+
{% extends "base.html" %}
10+
11+
{% from "components/idp_brand.html" import logo %}
12+
13+
{% block content %}
14+
{% if force_localpart %}
15+
<header class="page-heading">
16+
<div class="icon">
17+
{{ icon.download() }}
18+
</div>
19+
20+
<div class="header">
21+
<h1 class="title">
22+
{{ _("mas.upstream_oauth2.register.import_data.heading") }}
23+
</h1>
24+
<p class="text">
25+
{{ _("mas.upstream_oauth2.register.import_data.description", server_name=branding.server_name) }}
26+
</p>
27+
</div>
28+
</header>
29+
{% elif upstream_oauth_provider.human_name %}
30+
<header class="page-heading">
31+
<div class="icon">
32+
{{ icon.user_profile_solid() }}
33+
</div>
34+
35+
<div class="header">
36+
<h1 class="title">
37+
{{ _("mas.upstream_oauth2.register.signup_with_upstream.heading", human_name=upstream_oauth_provider.human_name) }}
38+
</h1>
39+
</div>
40+
</header>
41+
{% else %}
42+
<header class="page-heading">
43+
<div class="icon">
44+
{{ icon.mention() }}
45+
</div>
46+
47+
<div class="header">
48+
<h1 class="title">
49+
{{ _("mas.upstream_oauth2.register.choose_username.heading") }}
50+
</h1>
51+
<p class="text">
52+
{{ _("mas.upstream_oauth2.register.choose_username.description") }}
53+
</p>
54+
</div>
55+
</header>
56+
{% endif %}
57+
58+
{% if upstream_oauth_provider.human_name %}
59+
<section class="upstream-oauth2-provider-account">
60+
{% if upstream_oauth_provider.brand_name %}
61+
{{ logo(brand=upstream_oauth_provider.brand_name, class="brand") }}
62+
{% else %}
63+
{{ icon.user_profile() }}
64+
{% endif %}
65+
66+
<div class="infos">
67+
<h3 class="provider">
68+
{{- _("mas.upstream_oauth2.register.provider_name", human_name=upstream_oauth_provider.human_name) -}}
69+
</h3>
70+
{% if upstream_oauth_link.human_account_name %}
71+
<p class="account">
72+
{{- upstream_oauth_link.human_account_name -}}
73+
</p>
74+
{% endif %}
75+
</div>
76+
</section>
77+
{% endif %}
78+
79+
<form method="POST" class="cpd-form-root">
80+
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
81+
<input type="hidden" name="action" value="register" />
82+
83+
{% if form_state.errors is not empty %}
84+
{% for error in form_state.errors %}
85+
<div class="text-critical font-medium">
86+
{{- errors.form_error_message(error=error) -}}
87+
</div>
88+
{% endfor %}
89+
{% endif %}
90+
91+
92+
<!-- :tchap: hide localpart from display -->
93+
{% if False %}
94+
<!-- :tchap: -->
95+
{% if force_localpart %}
96+
{% call(f) field.field(label=_("common.mxid"), name="mxid") %}
97+
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" value="@{{ imported_localpart }}:{{ branding.server_name }}" readonly aria-describedby="{{ f.id }}-help" />
98+
99+
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
100+
{{- _("mas.upstream_oauth2.register.enforced_by_policy") -}}
101+
</div>
102+
{% endcall %}
103+
{% else %}
104+
{% call(f) field.field(label=_("common.username"), name="username", form_state=form_state) %}
105+
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" autocomplete="username" autocorrect="off" autocapitalize="none" value="{{ imported_localpart or '' }}" aria-describedby="{{ f.id }}-help" />
106+
107+
{% if f.errors is empty %}
108+
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
109+
@{{ imported_localpart or (_("common.username") | lower) }}:{{ branding.server_name }}
110+
</div>
111+
{% endif %}
112+
{% endcall %}
113+
{% endif %}
114+
<!-- :tchap: -->
115+
{% endif %}
116+
<!-- :tchap: -->
117+
118+
{% if imported_email %}
119+
<div class="flex gap-6 items-center">
120+
{% call(f) field.field(label=_("common.email_address"), name="email", class="flex-1") %}
121+
<input {{ field.attributes(f) }} class="cpd-text-control" type="email" value="{{ imported_email }}" readonly aria-describedby="{{ f.id }}-help" />
122+
123+
<div class="cpd-form-message cpd-form-help-message" id="{{ f.id }}-help">
124+
{% if upstream_oauth_provider.human_name %}
125+
{{- _("mas.upstream_oauth2.register.imported_from_upstream_with_name", human_name=upstream_oauth_provider.human_name) -}}
126+
{% else %}
127+
{{- _("mas.upstream_oauth2.register.imported_from_upstream") -}}
128+
{% endif %}
129+
</div>
130+
{% endcall %}
131+
132+
{% if not force_email %}
133+
<div class="cpd-form-inline-field">
134+
<div class="cpd-form-inline-field-control">
135+
<div class="cpd-checkbox-container">
136+
<input class="cpd-checkbox-input" type="checkbox" name="import_email" id="import_email" checked="checked" />
137+
<div class="cpd-checkbox-ui">
138+
{{ icon.check() }}
139+
</div>
140+
</div>
141+
</div>
142+
<label class="cpd-form-label" for="import_email">
143+
{{- _("mas.upstream_oauth2.register.use") -}}
144+
</label>
145+
</div>
146+
{% endif %}
147+
</div>
148+
{% endif %}
149+
150+
{% if imported_display_name %}
151+
<div class="flex gap-6 items-center">
152+
{% call(f) field.field(label=_("common.display_name"), name="display_name", class="flex-1") %}
153+
<input {{ field.attributes(f) }} class="cpd-text-control" type="text" value="{{ imported_display_name }}" readonly />
154+
155+
<div class="cpd-form-message cpd-form-help-message">
156+
{% if upstream_oauth_provider.human_name %}
157+
{{- _("mas.upstream_oauth2.register.imported_from_upstream_with_name", human_name=upstream_oauth_provider.human_name) -}}
158+
{% else %}
159+
{{- _("mas.upstream_oauth2.register.imported_from_upstream") -}}
160+
{% endif %}
161+
</div>
162+
{% endcall %}
163+
164+
{% if not force_display_name %}
165+
<div class="cpd-form-inline-field">
166+
<div class="cpd-form-inline-field-control">
167+
<div class="cpd-checkbox-container">
168+
<input class="cpd-checkbox-input" type="checkbox" name="import_display_name" id="import_display_name" checked="checked" />
169+
<div class="cpd-checkbox-ui">
170+
{{ icon.check() }}
171+
</div>
172+
</div>
173+
</div>
174+
<div class="cpd-form-inline-field-body">
175+
<label class="cpd-form-label" for="import_display_name">
176+
{{- _("mas.upstream_oauth2.register.use") -}}
177+
</label>
178+
</div>
179+
</div>
180+
{% endif %}
181+
</div>
182+
{% endif %}
183+
184+
{% if branding.tos_uri %}
185+
{% call(f) field.field(label=_("mas.register.terms_of_service", tos_uri=branding.tos_uri), name="accept_terms", form_state=form_state, inline=true, class="my-4") %}
186+
<div class="cpd-form-inline-field-control">
187+
<div class="cpd-checkbox-container">
188+
<input {{ field.attributes(f) }} class="cpd-checkbox-input" type="checkbox" required />
189+
<div class="cpd-checkbox-ui">
190+
{{ icon.check() }}
191+
</div>
192+
</div>
193+
</div>
194+
{% endcall %}
195+
{% endif %}
196+
197+
{{ button.button(text=_("action.create_account")) }}
198+
</form>
199+
{% endblock content %}

tchap/resources/translations/en.json

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
},
77
"cancel": "Cancel",
88
"@cancel": {
9-
"context": "consent.html:69:11-29, pages/consent.html:69:11-29, pages/device_consent.html:127:13-31, pages/policy_violation.html:44:13-31"
9+
"context": "consent.html:69:11-29, pages/consent.html:79:11-29, pages/device_consent.html:127:13-31, pages/policy_violation.html:44:13-31"
1010
},
1111
"continue": "Continue",
1212
"@continue": {
13-
"context": "consent.html:57:28-48, form_post.html:25:28-48, pages/consent.html:57: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: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"
1414
},
1515
"create_account": "Create Account",
1616
"@create_account": {
17-
"context": "pages/login.html:126:33-59, pages/upstream_oauth2/do_register.html:191:26-52"
17+
"context": "pages/login.html:126:33-59, pages/upstream_oauth2/do_register.html:197:26-52"
1818
},
1919
"sign_in": "Sign in",
2020
"@sign_in": {
2121
"context": "index.html:39:26-45, pages/account/deactivated.html:23:28-47, pages/account/locked.html:23:28-47, pages/index.html:30:26-45"
2222
},
2323
"sign_out": "Sign out",
2424
"@sign_out": {
25-
"context": "index.html:37:28-48, pages/account/logged_out.html:22:28-48, pages/consent.html:65:28-48, pages/device_consent.html:136:30-50, pages/index.html:28:28-48, pages/policy_violation.html:38:28-48, pages/sso.html:45:28-48, pages/upstream_oauth2/link_mismatch.html:24:24-44, pages/upstream_oauth2/suggest_link.html:32:26-46"
25+
"context": "index.html:37:28-48, pages/account/logged_out.html:22:28-48, pages/consent.html:75:28-48, pages/device_consent.html:136:30-50, pages/index.html:28:28-48, pages/policy_violation.html:38:28-48, pages/sso.html:45:28-48, pages/upstream_oauth2/link_mismatch.html:24:24-44, pages/upstream_oauth2/suggest_link.html:32:26-46"
2626
},
2727
"skip": "Skip",
2828
"@skip": {
@@ -75,11 +75,11 @@
7575
"common": {
7676
"display_name": "Display Name",
7777
"@display_name": {
78-
"context": "pages/register/steps/display_name.html:34:35-59, pages/upstream_oauth2/do_register.html:146:37-61"
78+
"context": "pages/register/steps/display_name.html:34:35-59, pages/upstream_oauth2/do_register.html:152:37-61"
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:114:37-62"
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"
8383
},
8484
"hide": "",
8585
"@hide": {},
@@ -89,7 +89,7 @@
8989
},
9090
"mxid": "Matrix ID",
9191
"@mxid": {
92-
"context": "pages/upstream_oauth2/do_register.html:93:35-51"
92+
"context": "pages/upstream_oauth2/do_register.html:96:35-51"
9393
},
9494
"password": "Password",
9595
"@password": {
@@ -103,7 +103,7 @@
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:101:35-55, pages/upstream_oauth2/do_register.html:106:39-59"
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"
107107
}
108108
},
109109
"error": {
@@ -195,23 +195,23 @@
195195
"consent": {
196196
"client_wants_access": "This new device will be shown in Tchap devices list.",
197197
"@client_wants_access": {
198-
"context": "consent.html:27:11-122, pages/consent.html:27:11-122"
198+
"context": "consent.html:27:11-122, pages/consent.html:31:11-122"
199199
},
200200
"heading": "Connect this new device to your Tchap account",
201201
"@heading": {
202-
"context": "consent.html:25:27-51, pages/consent.html:25:27-51, pages/device_consent.html:28:29-53"
202+
"context": "consent.html:25:27-51, pages/consent.html:29:27-51, pages/device_consent.html:28:29-53"
203203
},
204204
"make_sure_you_trust": "",
205205
"@make_sure_you_trust": {
206-
"context": "consent.html:38:81-142, pages/consent.html:38:81-142, pages/device_consent.html:104:83-144"
206+
"context": "consent.html:38:81-142, pages/consent.html:44:81-142, pages/device_consent.html:104:83-144"
207207
},
208208
"this_will_allow": "",
209209
"@this_will_allow": {
210-
"context": "consent.html:28:11-68, pages/consent.html:28:11-68, pages/device_consent.html:94:13-70"
210+
"context": "consent.html:28:11-68, pages/consent.html:32:11-68, pages/device_consent.html:94:13-70"
211211
},
212212
"you_may_be_sharing": "",
213213
"@you_may_be_sharing": {
214-
"context": "consent.html:39:7-42, pages/consent.html:39:7-42, pages/device_consent.html:105:9-44"
214+
"context": "consent.html:39:7-42, pages/consent.html:45:7-42, pages/device_consent.html:105:9-44"
215215
}
216216
},
217217
"device_card": {
@@ -466,16 +466,13 @@
466466
"my_account": "My account",
467467
"@my_account": {
468468
"context": "index.html:36:26-52, pages/index.html:27:26-52"
469-
"context": "index.html:36:26-52, pages/index.html:27:26-52"
470469
},
471470
"register": "Create an account",
472471
"@register": {
473472
"context": "index.html:42:36-60, pages/index.html:33:36-60"
474-
"context": "index.html:42:36-60, pages/index.html:33:36-60"
475473
},
476474
"signed_in_as": "Signed in as <span class=\"font-semibold\">%(username)s</span>.",
477475
"@signed_in_as": {
478-
"context": "index.html:33:11-79, pages/index.html:24:11-79",
479476
"context": "index.html:33:11-79, pages/index.html:24:11-79",
480477
"description": "Displayed in the navbar when the user is signed in"
481478
}
@@ -492,7 +489,7 @@
492489
},
493490
"not_you": "Not %(username)s?",
494491
"@not_you": {
495-
"context": "consent.html:62:11-67, pages/consent.html:62:11-67, pages/device_consent.html:133:13-69, pages/sso.html:42:11-67",
492+
"context": "consent.html:62:11-67, pages/consent.html:72:11-67, pages/device_consent.html:133:13-69, pages/sso.html:42:11-67",
496493
"description": "Suggestions for the user to log in as a different user"
497494
},
498495
"or_separator": "Or",
@@ -639,7 +636,7 @@
639636
},
640637
"terms_of_service": "I agree to the <a href=\"%s\" data-kind=\"primary\" class=\"cpd-link\">Terms and Conditions</a>",
641638
"@terms_of_service": {
642-
"context": "pages/register/password.html:51:35-95, pages/upstream_oauth2/do_register.html:179:35-95"
639+
"context": "pages/register/password.html:51:35-95, pages/upstream_oauth2/do_register.html:185:35-95"
643640
}
644641
},
645642
"registration_token": {
@@ -732,7 +729,7 @@
732729
},
733730
"enforced_by_policy": "Enforced by server policy",
734731
"@enforced_by_policy": {
735-
"context": "pages/upstream_oauth2/do_register.html:97:14-66"
732+
"context": "pages/upstream_oauth2/do_register.html:100:14-66"
736733
},
737734
"forced_display_name": "Will use the following display name",
738735
"@forced_display_name": {
@@ -758,11 +755,11 @@
758755
},
759756
"imported_from_upstream": "Imported from your upstream account",
760757
"@imported_from_upstream": {
761-
"context": "pages/upstream_oauth2/do_register.html:121:18-74, pages/upstream_oauth2/do_register.html:153:18-74"
758+
"context": "pages/upstream_oauth2/do_register.html:127:18-74, pages/upstream_oauth2/do_register.html:159:18-74"
762759
},
763760
"imported_from_upstream_with_name": "Imported from your %(human_name)s account",
764761
"@imported_from_upstream_with_name": {
765-
"context": "pages/upstream_oauth2/do_register.html:119:18-131, pages/upstream_oauth2/do_register.html:151:18-131"
762+
"context": "pages/upstream_oauth2/do_register.html:125:18-131, pages/upstream_oauth2/do_register.html:157:18-131"
766763
},
767764
"link_existing": "Link to an existing account",
768765
"@link_existing": {
@@ -788,7 +785,7 @@
788785
},
789786
"use": "Use",
790787
"@use": {
791-
"context": "pages/upstream_oauth2/do_register.html:137:18-55, pages/upstream_oauth2/do_register.html:170:20-57"
788+
"context": "pages/upstream_oauth2/do_register.html:143:18-55, pages/upstream_oauth2/do_register.html:176:20-57"
792789
}
793790
},
794791
"suggest_link": {

0 commit comments

Comments
 (0)