@contember/create 2.2.0-alpha.3 → 2.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -0
- package/dist/development/run.cjs +7 -7
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +8 -8
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +27 -13
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +72 -60
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +72 -60
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/run.cjs +7 -7
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +8 -8
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +27 -13
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +72 -60
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +72 -60
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +15 -3
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +9 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/resources/templates/default/README.md +3 -1
- package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
- package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
- package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
- package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
- package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
- package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
- package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
- package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +182 -0
- package/resources/templates/default/admin/lib/tenant/dict.ts +443 -4
- package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
- package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
- package/resources/templates/default/admin/lib/tenant/forms/common.tsx +9 -2
- package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
- package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/forms/index.ts +11 -0
- package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +42 -4
- package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -10
- package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +3 -1
- package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -10
- package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
- package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
- package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
- package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
- package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
- package/resources/templates/default/admin/lib/tenant/index.ts +7 -0
- package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +160 -22
- package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
- package/resources/templates/default/admin/lib/tenant/listing/index.ts +7 -0
- package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +1 -1
- package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +20 -11
- package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +13 -2
- package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
- package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
- package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
- package/resources/templates/default/admin/lib/tenant/otp/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
- package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
- package/resources/templates/default/admin/package.json +1 -0
- package/resources/templates/default/docker/object-storage/README.md +13 -0
- package/resources/templates/default/docker/object-storage/identities.json +13 -0
- package/resources/templates/default/docker-compose.yaml +29 -7
- package/src/commands/WorkspaceCreateCommand.ts +42 -14
- package/src/lib/TemplateInstaller.ts +87 -69
- package/src/run.ts +8 -7
- package/tests/cases/unit/create-process.test.ts +66 -0
- package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
- package/tests/cases/unit/workspace-create.test.ts +81 -0
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { InviteErrorCodes } from './hooks/useInvite.js'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AddProjectMemberFormErrorCode,
|
|
4
|
+
ChangeMyPasswordFormErrorCode,
|
|
5
|
+
ChangeMyProfileFormErrorCode,
|
|
6
|
+
ChangePasswordFormErrorCode,
|
|
7
|
+
ChangeProfileFormErrorCode,
|
|
8
|
+
CreateApiKeyFormErrorCode,
|
|
9
|
+
CreateGlobalApiKeyFormErrorCode,
|
|
10
|
+
SetProjectSecretFormErrorCode,
|
|
11
|
+
} from '@contember/interface'
|
|
3
12
|
import {
|
|
4
13
|
ConfirmEmailChangeFormErrorCode,
|
|
14
|
+
EmailOtpConfirmFormErrorCode,
|
|
5
15
|
InviteFormErrorCode,
|
|
6
16
|
LoginFormErrorCode,
|
|
7
17
|
OtpConfirmFormErrorCode,
|
|
@@ -11,10 +21,17 @@ import {
|
|
|
11
21
|
PasswordResetFormErrorCode,
|
|
12
22
|
PasswordResetRequestFormErrorCode,
|
|
13
23
|
RequestEmailVerificationFormErrorCode,
|
|
24
|
+
SignUpFormErrorCode,
|
|
14
25
|
UpdateProjectMemberFormErrorCode,
|
|
15
26
|
VerifyEmailFormErrorCode,
|
|
16
27
|
} from '@contember/react-identity'
|
|
17
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
ActivatePasswordlessOtpErrorCode,
|
|
30
|
+
AddGlobalIdentityRolesErrorCode,
|
|
31
|
+
DisconnectIDPErrorCode,
|
|
32
|
+
RemoveGlobalIdentityRolesErrorCode,
|
|
33
|
+
} from '@contember/graphql-client-tenant'
|
|
34
|
+
import { FormErrorCode } from '@contember/react-client-tenant'
|
|
18
35
|
|
|
19
36
|
export const dict = {
|
|
20
37
|
inviteErrors: {
|
|
@@ -28,6 +45,11 @@ export const dict = {
|
|
|
28
45
|
fallback: 'Failed to invite user',
|
|
29
46
|
} satisfies Record<InviteErrorCodes | 'fallback', string>,
|
|
30
47
|
tenant: {
|
|
48
|
+
/** Fallback for the codes any form or action can raise; a per-form `errorMessages` entry still wins. */
|
|
49
|
+
commonErrorMessages: {
|
|
50
|
+
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
51
|
+
FORBIDDEN: 'You do not have permission to do this',
|
|
52
|
+
} satisfies Record<FormErrorCode, string>,
|
|
31
53
|
memberList: {
|
|
32
54
|
failedToLoadData: 'Failed to load data',
|
|
33
55
|
noResults: 'No results',
|
|
@@ -47,6 +69,23 @@ export const dict = {
|
|
|
47
69
|
deleteConfirmation: 'Are you sure you want to delete this API key?',
|
|
48
70
|
deleteCancelAction: 'Cancel',
|
|
49
71
|
deleteConfirmAction: 'Delete',
|
|
72
|
+
type: 'Type',
|
|
73
|
+
roles: 'Roles',
|
|
74
|
+
status: 'Status',
|
|
75
|
+
created: 'Created',
|
|
76
|
+
lastUsed: 'Last used',
|
|
77
|
+
expires: 'Expires',
|
|
78
|
+
enabled: 'Enabled',
|
|
79
|
+
disabled: 'Disabled',
|
|
80
|
+
noRoles: 'None',
|
|
81
|
+
never: 'Never',
|
|
82
|
+
unknownType: 'Unknown',
|
|
83
|
+
failedToLoadData: 'Failed to load data',
|
|
84
|
+
disableConfirmation: 'Are you sure you want to disable this API key?',
|
|
85
|
+
disableSuccess: 'API key disabled',
|
|
86
|
+
disableFailed: 'Failed to disable API key',
|
|
87
|
+
cancel: 'Cancel',
|
|
88
|
+
disable: 'Disable',
|
|
50
89
|
},
|
|
51
90
|
createApiKey: {
|
|
52
91
|
description: 'Description',
|
|
@@ -67,7 +106,11 @@ export const dict = {
|
|
|
67
106
|
name: 'Name',
|
|
68
107
|
roles: 'Roles',
|
|
69
108
|
submit: 'Invite',
|
|
109
|
+
submitUnmanaged: 'Create member',
|
|
70
110
|
addRole: 'Add new role',
|
|
111
|
+
unmanaged: 'Do not send an invitation e-mail',
|
|
112
|
+
unmanagedDescription: 'Creates the member directly. Leave the password empty to make them use a password reset.',
|
|
113
|
+
password: 'Password',
|
|
71
114
|
errorMessages: {
|
|
72
115
|
'FIELD_REQUIRED': 'This field is required',
|
|
73
116
|
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
@@ -99,7 +142,12 @@ export const dict = {
|
|
|
99
142
|
login: {
|
|
100
143
|
email: 'Email',
|
|
101
144
|
password: 'Password',
|
|
102
|
-
|
|
145
|
+
mfa: {
|
|
146
|
+
otpToken: '2FA OTP token',
|
|
147
|
+
backupCode: 'Backup code',
|
|
148
|
+
useBackupCode: 'Lost your authenticator? Use a backup code.',
|
|
149
|
+
useOtpToken: 'Use your authenticator app instead.',
|
|
150
|
+
},
|
|
103
151
|
forgotPassword: 'Forgot password?',
|
|
104
152
|
login: 'Login',
|
|
105
153
|
errorMessages: {
|
|
@@ -141,6 +189,218 @@ export const dict = {
|
|
|
141
189
|
cancel: 'Cancel',
|
|
142
190
|
confirm: 'Confirm',
|
|
143
191
|
},
|
|
192
|
+
mfa: {
|
|
193
|
+
totp: 'TOTP',
|
|
194
|
+
email: 'Email OTP',
|
|
195
|
+
none: 'None',
|
|
196
|
+
},
|
|
197
|
+
personsList: {
|
|
198
|
+
email: 'Email',
|
|
199
|
+
name: 'Name',
|
|
200
|
+
roles: 'Roles',
|
|
201
|
+
mfa: '2FA',
|
|
202
|
+
noEmail: 'No email',
|
|
203
|
+
noName: 'No name',
|
|
204
|
+
noRoles: 'None',
|
|
205
|
+
noResults: 'No users',
|
|
206
|
+
failedToLoadData: 'Failed to load data',
|
|
207
|
+
filterEmailPlaceholder: 'Filter by email',
|
|
208
|
+
previous: 'Previous',
|
|
209
|
+
next: 'Next',
|
|
210
|
+
status: 'Status',
|
|
211
|
+
active: 'Active',
|
|
212
|
+
disabled: 'Disabled',
|
|
213
|
+
actions: 'Actions',
|
|
214
|
+
},
|
|
215
|
+
globalApiKeyList: {
|
|
216
|
+
description: 'Description',
|
|
217
|
+
type: 'Type',
|
|
218
|
+
status: 'Status',
|
|
219
|
+
roles: 'Roles',
|
|
220
|
+
created: 'Created',
|
|
221
|
+
lastUsed: 'Last used',
|
|
222
|
+
expires: 'Expires',
|
|
223
|
+
action: 'Action',
|
|
224
|
+
enabled: 'Enabled',
|
|
225
|
+
disabled: 'Disabled',
|
|
226
|
+
unnamed: 'Unnamed API key',
|
|
227
|
+
noRoles: 'None',
|
|
228
|
+
never: 'Never',
|
|
229
|
+
noResults: 'No API keys',
|
|
230
|
+
failedToLoadData: 'Failed to load data',
|
|
231
|
+
previous: 'Previous',
|
|
232
|
+
next: 'Next',
|
|
233
|
+
disableConfirmation: 'Are you sure you want to disable this API key?',
|
|
234
|
+
disableSuccess: 'API key disabled',
|
|
235
|
+
disableFailed: 'Failed to disable API key',
|
|
236
|
+
cancel: 'Cancel',
|
|
237
|
+
disable: 'Disable',
|
|
238
|
+
},
|
|
239
|
+
createGlobalApiKey: {
|
|
240
|
+
description: 'Description',
|
|
241
|
+
roles: 'Roles',
|
|
242
|
+
addRole: 'Add role',
|
|
243
|
+
removeRole: 'Remove role',
|
|
244
|
+
rolePlaceholder: 'Role name',
|
|
245
|
+
submit: 'Create API key',
|
|
246
|
+
errorMessages: {
|
|
247
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
248
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
249
|
+
'INVALID_MEMBERSHIP': 'Invalid membership',
|
|
250
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
251
|
+
'ROLE_NOT_FOUND': 'Role not found',
|
|
252
|
+
'VARIABLE_EMPTY': 'Variable empty',
|
|
253
|
+
'VARIABLE_NOT_FOUND': 'Variable not found',
|
|
254
|
+
} satisfies Record<CreateGlobalApiKeyFormErrorCode, string>,
|
|
255
|
+
},
|
|
256
|
+
projectSecretList: {
|
|
257
|
+
key: 'Key',
|
|
258
|
+
created: 'Created',
|
|
259
|
+
updated: 'Updated',
|
|
260
|
+
noResults: 'No secrets',
|
|
261
|
+
failedToLoadData: 'Failed to load data',
|
|
262
|
+
},
|
|
263
|
+
configView: {
|
|
264
|
+
failedToLoadData: 'Failed to load data',
|
|
265
|
+
forbidden: 'You do not have permission to view this.',
|
|
266
|
+
managedByCli: 'Read-only. Change this with',
|
|
267
|
+
managedByCliCommand: 'contember tenant:apply',
|
|
268
|
+
setting: 'Setting',
|
|
269
|
+
value: 'Value',
|
|
270
|
+
enabled: 'Enabled',
|
|
271
|
+
disabled: 'Disabled',
|
|
272
|
+
notSet: 'Not set',
|
|
273
|
+
/** An explicitly empty list — distinct from `notSet`, which is a value that was never configured. */
|
|
274
|
+
emptyList: 'None',
|
|
275
|
+
signup: 'Sign-up',
|
|
276
|
+
emailChange: 'E-mail change',
|
|
277
|
+
passwordless: 'Passwordless sign-in',
|
|
278
|
+
password: 'Password policy',
|
|
279
|
+
login: 'Login',
|
|
280
|
+
anomalyDetection: 'Anomaly detection',
|
|
281
|
+
captcha: 'Captcha',
|
|
282
|
+
rateLimits: 'Rate limits',
|
|
283
|
+
limit: 'Limit',
|
|
284
|
+
window: 'Window',
|
|
285
|
+
panelAccess: 'Management panel access',
|
|
286
|
+
},
|
|
287
|
+
authPolicyList: {
|
|
288
|
+
scope: 'Scope',
|
|
289
|
+
project: 'Project',
|
|
290
|
+
roles: 'Roles',
|
|
291
|
+
mfaRequired: 'MFA required',
|
|
292
|
+
tokenExpiration: 'Token expiration',
|
|
293
|
+
idleTimeout: 'Idle timeout',
|
|
294
|
+
mfaGraceDuration: 'MFA grace',
|
|
295
|
+
rememberMeAllowed: 'Remember me',
|
|
296
|
+
noResults: 'No auth policies configured — MFA enforcement is inert.',
|
|
297
|
+
failedToLoadData: 'Failed to load data',
|
|
298
|
+
forbidden: 'You do not have permission to view auth policies.',
|
|
299
|
+
aggregationNote: 'An identity is subject to every policy matching any of its roles; the strictest value wins.',
|
|
300
|
+
},
|
|
301
|
+
identityProviderList: {
|
|
302
|
+
slug: 'Slug',
|
|
303
|
+
type: 'Type',
|
|
304
|
+
status: 'Status',
|
|
305
|
+
configuration: 'Configuration',
|
|
306
|
+
showConfiguration: 'Show configuration',
|
|
307
|
+
hideConfiguration: 'Hide configuration',
|
|
308
|
+
autoSignUp: 'Auto sign-up',
|
|
309
|
+
exclusive: 'Exclusive',
|
|
310
|
+
noResults: 'No identity providers configured',
|
|
311
|
+
failedToLoadData: 'Failed to load data',
|
|
312
|
+
forbidden: 'You do not have permission to view identity providers.',
|
|
313
|
+
secretsNote: 'Secrets are stripped server-side for the built-in oidc, apple and facebook handlers.',
|
|
314
|
+
},
|
|
315
|
+
mailTemplateList: {
|
|
316
|
+
type: 'Type',
|
|
317
|
+
variant: 'Variant',
|
|
318
|
+
project: 'Project',
|
|
319
|
+
subject: 'Subject',
|
|
320
|
+
replyTo: 'Reply to',
|
|
321
|
+
useLayout: 'Layout',
|
|
322
|
+
showContent: 'Show content',
|
|
323
|
+
hideContent: 'Hide content',
|
|
324
|
+
noResults: 'No custom mail templates — the built-in defaults are in use.',
|
|
325
|
+
failedToLoadData: 'Failed to load data',
|
|
326
|
+
forbidden: 'You do not have permission to view mail templates.',
|
|
327
|
+
},
|
|
328
|
+
changeMyProfile: {
|
|
329
|
+
email: 'Email',
|
|
330
|
+
name: 'Name',
|
|
331
|
+
submit: 'Save changes',
|
|
332
|
+
errorMessages: {
|
|
333
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
334
|
+
'INVALID_VALUE': 'Invalid value',
|
|
335
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
336
|
+
'NOT_A_PERSON': 'Invalid user',
|
|
337
|
+
'INVALID_EMAIL_FORMAT': 'Invalid email format',
|
|
338
|
+
'EMAIL_ALREADY_EXISTS': 'This e-mail address is already in use',
|
|
339
|
+
'RATE_LIMIT_EXCEEDED': 'Too many requests, please try again later',
|
|
340
|
+
} satisfies Record<ChangeMyProfileFormErrorCode | 'UNKNOWN_ERROR', string>,
|
|
341
|
+
},
|
|
342
|
+
emailOtpSetup: {
|
|
343
|
+
description: 'Get a one-time code by e-mail every time you sign in — a lightweight alternative to an authenticator app.',
|
|
344
|
+
sendCode: 'Send code by e-mail',
|
|
345
|
+
codeSent: 'A code has been sent to your e-mail address.',
|
|
346
|
+
otpToken: 'E-mail code',
|
|
347
|
+
confirm: 'Confirm',
|
|
348
|
+
emailOtpConfirmFormErrorMessages: {
|
|
349
|
+
INVALID_OTP_TOKEN: 'Invalid code',
|
|
350
|
+
FIELD_REQUIRED: 'This field is required',
|
|
351
|
+
INVALID_VALUE: 'Invalid value',
|
|
352
|
+
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
353
|
+
} satisfies Record<EmailOtpConfirmFormErrorCode, string>,
|
|
354
|
+
enabledSuccess: 'E-mail two-factor authentication was enabled.',
|
|
355
|
+
emailOtpEnabled: 'E-mail two-factor authentication is ENABLED.',
|
|
356
|
+
disableEmailOtp: 'Disable e-mail two-factor authentication',
|
|
357
|
+
disableEmailOtpConfirm: 'Are you sure you want to disable e-mail two-factor authentication?',
|
|
358
|
+
disable: 'Disable',
|
|
359
|
+
disabledSuccess: 'E-mail two-factor authentication was disabled.',
|
|
360
|
+
setupAgain: 'Send new code',
|
|
361
|
+
cancel: 'Cancel',
|
|
362
|
+
initFailed: 'Failed to send the code. Please try again later.',
|
|
363
|
+
disableFailed: 'Failed to disable e-mail two-factor authentication.',
|
|
364
|
+
},
|
|
365
|
+
backupCodes: {
|
|
366
|
+
description: 'Backup codes let you sign in if you lose access to your authenticator or e-mail codes.',
|
|
367
|
+
regenerate: 'Regenerate backup codes',
|
|
368
|
+
regenerateConfirm: 'Regenerating invalidates your existing backup codes. Are you sure you want to continue?',
|
|
369
|
+
regenerateSuccess: 'New backup codes were generated.',
|
|
370
|
+
regenerateFailed: 'Failed to generate new backup codes.',
|
|
371
|
+
cancel: 'Cancel',
|
|
372
|
+
noMfaActive: 'Backup codes are available once you enable two-factor authentication.',
|
|
373
|
+
writeDownNote: 'Write these down and keep them somewhere safe. Each code works once.',
|
|
374
|
+
},
|
|
375
|
+
passwordlessToggle: {
|
|
376
|
+
descriptionEnabled: 'Passwordless sign-in is ENABLED. You can sign in with a magic link sent to your e-mail, without a password.',
|
|
377
|
+
descriptionDisabled: 'Enable passwordless sign-in to sign in with a magic link sent to your e-mail, without a password.',
|
|
378
|
+
enable: 'Enable passwordless sign-in',
|
|
379
|
+
disable: 'Disable passwordless sign-in',
|
|
380
|
+
enabledSuccess: 'Passwordless sign-in was enabled.',
|
|
381
|
+
disabledSuccess: 'Passwordless sign-in was disabled.',
|
|
382
|
+
enforcedEnabled: 'Passwordless sign-in is ENABLED for everyone by a tenant-wide policy, so it cannot be turned off here.',
|
|
383
|
+
enforcedDisabled: 'Passwordless sign-in is turned off by a tenant-wide policy, so it cannot be enabled here.',
|
|
384
|
+
toggleFailed:
|
|
385
|
+
'Could not change passwordless sign-in. If this is your only sign-in method, set a password or enable two-factor authentication first.',
|
|
386
|
+
},
|
|
387
|
+
sessionList: {
|
|
388
|
+
failedToLoadData: 'Failed to load data',
|
|
389
|
+
noResults: 'No active sessions',
|
|
390
|
+
created: 'Created',
|
|
391
|
+
lastUsed: 'Last used',
|
|
392
|
+
ip: 'IP address',
|
|
393
|
+
userAgent: 'Device',
|
|
394
|
+
expires: 'Expires',
|
|
395
|
+
action: 'Action',
|
|
396
|
+
never: 'Never',
|
|
397
|
+
thisDevice: 'This device',
|
|
398
|
+
revoke: 'Revoke',
|
|
399
|
+
revokeConfirmation: 'Are you sure you want to revoke this session? The device will be signed out.',
|
|
400
|
+
revokeSuccess: 'Session revoked',
|
|
401
|
+
revokeFailed: 'Failed to revoke session',
|
|
402
|
+
cancel: 'Cancel',
|
|
403
|
+
},
|
|
144
404
|
otpSetup: {
|
|
145
405
|
prepareContinue: 'Continue',
|
|
146
406
|
otpConfirmFormErrorMessages: {
|
|
@@ -171,6 +431,26 @@ export const dict = {
|
|
|
171
431
|
confirm: 'Confirm',
|
|
172
432
|
},
|
|
173
433
|
|
|
434
|
+
signUp: {
|
|
435
|
+
email: 'E-mail',
|
|
436
|
+
name: 'Name',
|
|
437
|
+
password: 'Password',
|
|
438
|
+
passwordConfirmation: 'Confirm password',
|
|
439
|
+
submit: 'Create account',
|
|
440
|
+
errorMessages: {
|
|
441
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
442
|
+
'INVALID_VALUE': 'Invalid value',
|
|
443
|
+
'PASSWORD_MISMATCH': 'Passwords do not match',
|
|
444
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
445
|
+
'EMAIL_ALREADY_EXISTS': 'An account with this e-mail already exists',
|
|
446
|
+
'INVALID_EMAIL_FORMAT': 'Invalid e-mail format',
|
|
447
|
+
'TOO_WEAK': 'Password is too weak',
|
|
448
|
+
'INVALID_CAPTCHA': 'Captcha verification failed',
|
|
449
|
+
'RATE_LIMIT_EXCEEDED': 'Too many attempts. Please try again later',
|
|
450
|
+
} satisfies Record<SignUpFormErrorCode, string>,
|
|
451
|
+
title: 'Create an account',
|
|
452
|
+
},
|
|
453
|
+
|
|
174
454
|
passwordReset: {
|
|
175
455
|
token: 'Reset code',
|
|
176
456
|
password: 'Password',
|
|
@@ -278,7 +558,12 @@ export const dict = {
|
|
|
278
558
|
},
|
|
279
559
|
passwordlessSignIn: {
|
|
280
560
|
token: 'Verification code',
|
|
281
|
-
|
|
561
|
+
mfa: {
|
|
562
|
+
otpToken: '2FA OTP token',
|
|
563
|
+
backupCode: 'Backup code',
|
|
564
|
+
useBackupCode: 'Lost your authenticator? Use a backup code.',
|
|
565
|
+
useOtpToken: 'Use your authenticator app instead.',
|
|
566
|
+
},
|
|
282
567
|
submit: 'Sign in',
|
|
283
568
|
errorMessages: {
|
|
284
569
|
'FIELD_REQUIRED': 'This field is required',
|
|
@@ -320,5 +605,159 @@ export const dict = {
|
|
|
320
605
|
'NOT_MEMBER': 'Not a member',
|
|
321
606
|
} satisfies Record<UpdateProjectMemberFormErrorCode, string>,
|
|
322
607
|
},
|
|
608
|
+
personActions: {
|
|
609
|
+
cancel: 'Cancel',
|
|
610
|
+
disable: 'Disable',
|
|
611
|
+
disableTitle: 'Disable person',
|
|
612
|
+
disableConfirmation: 'Are you sure you want to disable this person? They will not be able to sign in.',
|
|
613
|
+
disableSuccess: 'Person disabled',
|
|
614
|
+
disableFailed: 'Failed to disable the person',
|
|
615
|
+
enable: 'Enable',
|
|
616
|
+
enableTitle: 'Enable person',
|
|
617
|
+
enableConfirmation: 'Are you sure you want to enable this person? They will be able to sign in again.',
|
|
618
|
+
enableSuccess: 'Person enabled',
|
|
619
|
+
enableFailed: 'Failed to enable the person',
|
|
620
|
+
forceSignOut: 'Sign out',
|
|
621
|
+
forceSignOutTitle: 'Force sign out',
|
|
622
|
+
forceSignOutConfirmation: 'Are you sure you want to sign this person out of all their sessions?',
|
|
623
|
+
forceSignOutReason: 'Reason (optional)',
|
|
624
|
+
forceSignOutReasonPlaceholder: 'Recorded in the audit log',
|
|
625
|
+
forceSignOutSuccess: 'Person signed out of all sessions',
|
|
626
|
+
forceSignOutFailed: 'Failed to sign the person out',
|
|
627
|
+
resetMfa: 'Reset 2FA',
|
|
628
|
+
resetMfaTitle: 'Reset two-factor authentication',
|
|
629
|
+
resetMfaConfirmation:
|
|
630
|
+
'Are you sure you want to reset two-factor authentication? This clears the TOTP authenticator, e-mail OTP and all backup codes.',
|
|
631
|
+
resetMfaSuccess: 'Two-factor authentication was reset',
|
|
632
|
+
resetMfaFailed: 'Failed to reset two-factor authentication',
|
|
633
|
+
},
|
|
634
|
+
personDetail: {
|
|
635
|
+
identityId: 'Identity ID',
|
|
636
|
+
failedToLoadData: 'Failed to load data',
|
|
637
|
+
notFound: 'Person not found',
|
|
638
|
+
profile: 'Profile',
|
|
639
|
+
profileUpdated: 'Profile updated',
|
|
640
|
+
password: 'Password',
|
|
641
|
+
passwordUpdated: 'Password updated',
|
|
642
|
+
mfa: 'Two-factor authentication',
|
|
643
|
+
globalRoles: 'Global roles',
|
|
644
|
+
sessions: 'Sessions',
|
|
645
|
+
identityProviders: 'Identity providers',
|
|
646
|
+
identityProvider: 'Provider',
|
|
647
|
+
identityProviderAccount: 'External account',
|
|
648
|
+
identityProviderConnectedAt: 'Connected',
|
|
649
|
+
identityProviderStatus: 'Status',
|
|
650
|
+
identityProviderDisabled: 'Disabled',
|
|
651
|
+
noIdentityProviders: 'No connected identity providers',
|
|
652
|
+
},
|
|
653
|
+
globalRoles: {
|
|
654
|
+
noRoles: 'No global roles',
|
|
655
|
+
rolePlaceholder: 'Role name',
|
|
656
|
+
addRole: 'Add role',
|
|
657
|
+
removeRole: 'Remove role',
|
|
658
|
+
addSuccess: 'Global role added',
|
|
659
|
+
removeSuccess: 'Global role removed',
|
|
660
|
+
errorMessages: {
|
|
661
|
+
'IDENTITY_NOT_FOUND': 'This identity no longer exists',
|
|
662
|
+
'INVALID_ROLE': 'This role is not defined in the tenant configuration',
|
|
663
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
664
|
+
} satisfies Record<AddGlobalIdentityRolesErrorCode | RemoveGlobalIdentityRolesErrorCode | 'UNKNOWN_ERROR', string>,
|
|
665
|
+
},
|
|
666
|
+
changeProfile: {
|
|
667
|
+
email: 'E-mail',
|
|
668
|
+
name: 'Name',
|
|
669
|
+
submit: 'Save profile',
|
|
670
|
+
errorMessages: {
|
|
671
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
672
|
+
'INVALID_VALUE': 'Invalid value',
|
|
673
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
674
|
+
'PERSON_NOT_FOUND': 'This person no longer exists',
|
|
675
|
+
'INVALID_EMAIL_FORMAT': 'Invalid email format',
|
|
676
|
+
'EMAIL_ALREADY_EXISTS': 'This e-mail address is already in use',
|
|
677
|
+
} satisfies Record<ChangeProfileFormErrorCode, string>,
|
|
678
|
+
},
|
|
679
|
+
setPersonPassword: {
|
|
680
|
+
password: 'New password',
|
|
681
|
+
passwordConfirmation: 'Confirm password',
|
|
682
|
+
submit: 'Set password',
|
|
683
|
+
errorMessages: {
|
|
684
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
685
|
+
'INVALID_VALUE': 'Invalid value',
|
|
686
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
687
|
+
'PASSWORD_MISMATCH': 'Passwords do not match',
|
|
688
|
+
'TOO_WEAK': 'Password is too weak',
|
|
689
|
+
'PERSON_NOT_FOUND': 'This person no longer exists',
|
|
690
|
+
} satisfies Record<ChangePasswordFormErrorCode, string>,
|
|
691
|
+
},
|
|
692
|
+
setProjectSecret: {
|
|
693
|
+
key: 'Key',
|
|
694
|
+
value: 'Value',
|
|
695
|
+
submit: 'Set secret',
|
|
696
|
+
errorMessages: {
|
|
697
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
698
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
699
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
700
|
+
} satisfies Record<SetProjectSecretFormErrorCode, string>,
|
|
701
|
+
},
|
|
702
|
+
addProjectMember: {
|
|
703
|
+
identityId: 'Identity ID',
|
|
704
|
+
roles: 'Roles',
|
|
705
|
+
submit: 'Add member',
|
|
706
|
+
errorMessages: {
|
|
707
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
708
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
709
|
+
'ALREADY_MEMBER': 'This identity is already a member of the project',
|
|
710
|
+
'IDENTITY_NOT_FOUND': 'Identity not found',
|
|
711
|
+
'INVALID_MEMBERSHIP': 'Invalid membership',
|
|
712
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
713
|
+
'ROLE_NOT_FOUND': 'Role not found',
|
|
714
|
+
'VARIABLE_EMPTY': 'Variable empty',
|
|
715
|
+
'VARIABLE_NOT_FOUND': 'Variable not found',
|
|
716
|
+
} satisfies Record<AddProjectMemberFormErrorCode, string>,
|
|
717
|
+
},
|
|
718
|
+
authLog: {
|
|
719
|
+
createdAt: 'Created',
|
|
720
|
+
type: 'Type',
|
|
721
|
+
success: 'Result',
|
|
722
|
+
person: 'Person',
|
|
723
|
+
ipAddress: 'IP address',
|
|
724
|
+
errorCode: 'Error',
|
|
725
|
+
action: 'Action',
|
|
726
|
+
ok: 'OK',
|
|
727
|
+
failed: 'Failed',
|
|
728
|
+
filterTypes: 'Event types',
|
|
729
|
+
filterTypesPlaceholder: 'e.g. sign_in, sign_in_error (comma separated)',
|
|
730
|
+
filterSuccess: 'Result',
|
|
731
|
+
filterSuccessAll: 'All',
|
|
732
|
+
filterSuccessOk: 'Successful only',
|
|
733
|
+
filterSuccessFailed: 'Failed only',
|
|
734
|
+
filterPerson: 'Person identifier',
|
|
735
|
+
filterPersonPlaceholder: 'E-mail or identifier used to sign in',
|
|
736
|
+
noResults: 'No entries',
|
|
737
|
+
forbidden: 'You do not have permission to view the auth log.',
|
|
738
|
+
failedToLoadData: 'Failed to load data',
|
|
739
|
+
previous: 'Previous',
|
|
740
|
+
next: 'Next',
|
|
741
|
+
},
|
|
742
|
+
identityProviderConnections: {
|
|
743
|
+
provider: 'Provider',
|
|
744
|
+
account: 'External account',
|
|
745
|
+
connectedAt: 'Connected',
|
|
746
|
+
status: 'Status',
|
|
747
|
+
disabled: 'Disabled',
|
|
748
|
+
action: 'Action',
|
|
749
|
+
disconnect: 'Disconnect',
|
|
750
|
+
disconnectConfirmation: 'Are you sure you want to disconnect this identity provider?',
|
|
751
|
+
disconnected: 'Identity provider disconnected',
|
|
752
|
+
cancel: 'Cancel',
|
|
753
|
+
noResults: 'No connected identity providers',
|
|
754
|
+
failedToLoadData: 'Failed to load data',
|
|
755
|
+
errorMessages: {
|
|
756
|
+
'NOT_FOUND': 'This identity provider connection no longer exists',
|
|
757
|
+
'NOT_A_PERSON': 'Only a signed-in person can disconnect identity providers',
|
|
758
|
+
'LAST_AUTH_METHOD': 'You cannot disconnect your last remaining sign-in method',
|
|
759
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
760
|
+
} satisfies Record<DisconnectIDPErrorCode | 'UNKNOWN_ERROR', string>,
|
|
761
|
+
},
|
|
323
762
|
},
|
|
324
763
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormErrorCode } from '@contember/react-client-tenant'
|
|
2
|
+
import { dict } from './dict.js'
|
|
3
|
+
|
|
4
|
+
const forbidden: FormErrorCode = 'FORBIDDEN'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Message for a one-shot action that failed. A denial gets its own line, because "failed, try again"
|
|
8
|
+
* is wrong advice when the answer is simply no.
|
|
9
|
+
*/
|
|
10
|
+
export const actionErrorMessage = (code: string, failed: string): string => code === forbidden ? dict.tenant.commonErrorMessages.FORBIDDEN : failed
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useAddProjectMemberForm } from '@contember/react-identity'
|
|
2
|
+
import { Button } from '~/lib'
|
|
3
|
+
import { Loader } from '~/lib'
|
|
4
|
+
import { TenantFormError, TenantFormField, TenantFormLabel } from './common.js'
|
|
5
|
+
import { MembershipsControl, RolesConfig, useIntrospectionRolesConfig } from './memberships-control.js'
|
|
6
|
+
import { dict } from '../dict.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `AddProjectMemberFormFields` renders the fields of the `AddProjectMemberForm` provider — it adds an existing
|
|
10
|
+
* identity (as opposed to inviting a new person) to a project.
|
|
11
|
+
*
|
|
12
|
+
* ## Example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <AddProjectMemberFormFields projectSlug="my-project" />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const AddProjectMemberFormFields = ({ projectSlug, roles }: { projectSlug: string; roles?: RolesConfig }) => {
|
|
18
|
+
const form = useAddProjectMemberForm()
|
|
19
|
+
// Unconditionally, then pick: behind `??` the hook would run only on renders where `roles` is
|
|
20
|
+
// nullish, and a caller whose roles arrive from a query flips that mid-life.
|
|
21
|
+
const introspectedRoles = useIntrospectionRolesConfig(projectSlug)
|
|
22
|
+
const rolesResolved = roles ?? introspectedRoles
|
|
23
|
+
return (
|
|
24
|
+
<div className="relative flex flex-col gap-2">
|
|
25
|
+
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
26
|
+
|
|
27
|
+
<TenantFormError
|
|
28
|
+
form={form}
|
|
29
|
+
messages={dict.tenant.addProjectMember.errorMessages}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<TenantFormField
|
|
33
|
+
form={form}
|
|
34
|
+
messages={dict.tenant.addProjectMember.errorMessages}
|
|
35
|
+
field="identityId"
|
|
36
|
+
type="text"
|
|
37
|
+
required
|
|
38
|
+
autoFocus
|
|
39
|
+
autoComplete="off"
|
|
40
|
+
>
|
|
41
|
+
{dict.tenant.addProjectMember.identityId}
|
|
42
|
+
</TenantFormField>
|
|
43
|
+
|
|
44
|
+
<TenantFormLabel form={form} field="memberships">{dict.tenant.addProjectMember.roles}</TenantFormLabel>
|
|
45
|
+
<TenantFormError form={form} messages={dict.tenant.addProjectMember.errorMessages} field="memberships" />
|
|
46
|
+
<MembershipsControl
|
|
47
|
+
memberships={form.values.memberships}
|
|
48
|
+
setMemberships={it => form.setValue('memberships', it)}
|
|
49
|
+
roles={rolesResolved}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
|
|
53
|
+
{dict.tenant.addProjectMember.submit}
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useChangeMyProfileForm } from '@contember/react-identity'
|
|
2
|
+
import { Button } from '~/lib'
|
|
3
|
+
import { Loader } from '~/lib'
|
|
4
|
+
import { TenantFormError, TenantFormField } from './common.js'
|
|
5
|
+
import { dict } from '../dict.js'
|
|
6
|
+
|
|
7
|
+
export const ChangeMyProfileFormFields = () => {
|
|
8
|
+
const form = useChangeMyProfileForm()
|
|
9
|
+
return (
|
|
10
|
+
<div className="relative flex flex-col gap-2">
|
|
11
|
+
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
12
|
+
<TenantFormError
|
|
13
|
+
form={form}
|
|
14
|
+
messages={dict.tenant.changeMyProfile.errorMessages}
|
|
15
|
+
/>
|
|
16
|
+
<TenantFormField
|
|
17
|
+
form={form}
|
|
18
|
+
messages={dict.tenant.changeMyProfile.errorMessages}
|
|
19
|
+
field="email"
|
|
20
|
+
type="email"
|
|
21
|
+
autoComplete="email"
|
|
22
|
+
>
|
|
23
|
+
{dict.tenant.changeMyProfile.email}
|
|
24
|
+
</TenantFormField>
|
|
25
|
+
<TenantFormField
|
|
26
|
+
form={form}
|
|
27
|
+
messages={dict.tenant.changeMyProfile.errorMessages}
|
|
28
|
+
field="name"
|
|
29
|
+
type="text"
|
|
30
|
+
autoComplete="name"
|
|
31
|
+
>
|
|
32
|
+
{dict.tenant.changeMyProfile.name}
|
|
33
|
+
</TenantFormField>
|
|
34
|
+
|
|
35
|
+
<Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
|
|
36
|
+
{dict.tenant.changeMyProfile.submit}
|
|
37
|
+
</Button>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useChangeProfileForm } from '@contember/react-identity'
|
|
2
|
+
import { Button } from '~/lib'
|
|
3
|
+
import { Loader } from '~/lib'
|
|
4
|
+
import { TenantFormError, TenantFormField } from './common.js'
|
|
5
|
+
import { dict } from '../dict.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `ChangeProfileFormFields` renders the fields of the admin `ChangeProfileForm` provider.
|
|
9
|
+
*
|
|
10
|
+
* ## Example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <ChangeProfileForm personId={personId} initialValues={{ email, name }}>
|
|
13
|
+
* <form className="grid gap-4">
|
|
14
|
+
* <ChangeProfileFormFields />
|
|
15
|
+
* </form>
|
|
16
|
+
* </ChangeProfileForm>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const ChangeProfileFormFields = () => {
|
|
20
|
+
const form = useChangeProfileForm()
|
|
21
|
+
return (
|
|
22
|
+
<div className="relative flex flex-col gap-2">
|
|
23
|
+
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
24
|
+
|
|
25
|
+
<TenantFormError
|
|
26
|
+
form={form}
|
|
27
|
+
messages={dict.tenant.changeProfile.errorMessages}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<TenantFormField
|
|
31
|
+
form={form}
|
|
32
|
+
messages={dict.tenant.changeProfile.errorMessages}
|
|
33
|
+
field="email"
|
|
34
|
+
type="email"
|
|
35
|
+
autoComplete="off"
|
|
36
|
+
>
|
|
37
|
+
{dict.tenant.changeProfile.email}
|
|
38
|
+
</TenantFormField>
|
|
39
|
+
|
|
40
|
+
<TenantFormField
|
|
41
|
+
form={form}
|
|
42
|
+
messages={dict.tenant.changeProfile.errorMessages}
|
|
43
|
+
field="name"
|
|
44
|
+
type="text"
|
|
45
|
+
autoComplete="off"
|
|
46
|
+
>
|
|
47
|
+
{dict.tenant.changeProfile.name}
|
|
48
|
+
</TenantFormField>
|
|
49
|
+
|
|
50
|
+
<Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
|
|
51
|
+
{dict.tenant.changeProfile.submit}
|
|
52
|
+
</Button>
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
}
|