@abpjs/ui 0.2.0-next.30 → 0.2.0-next.31
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/CHANGELOG.md +20 -0
- package/dist/guard.d.ts +84 -13
- package/dist/guard.js +235 -38
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +487 -445
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-next.31
|
|
4
|
+
|
|
5
|
+
A prerelease under npm's `next` tag.
|
|
6
|
+
|
|
7
|
+
- `SaveBar`: a page edited in place with unsaved changes. A bar on the selected tint floats at the foot of the window,
|
|
8
|
+
centred, with the question, how many changes wait (`count`, or the host's `message`), Discard and Save (`busy`,
|
|
9
|
+
`saveDisabled`). New optional labels: `saveBar`, `unsavedChanges` (ICU plural on `{count}`), `discard`, `save`.
|
|
10
|
+
- guard: the types come from AbpGuard 0.9.0's document. The page answers are `GuardPagedResultDto` (`groups` beside
|
|
11
|
+
`items`), and `types.ts` names the people actions' inputs and answers.
|
|
12
|
+
- guard › Sign-up, the design canvas's board:
|
|
13
|
+
- the allowed domains are a list, with Add domain and Remove, each checked as a domain and listed once;
|
|
14
|
+
- with sign-up on, the directory is required, and the field says so;
|
|
15
|
+
- the save bar replaces the Save button, and Discard puts back what's saved;
|
|
16
|
+
- a domain typed but not added counts as a change and is added on Save; one that isn't a domain stops the save;
|
|
17
|
+
- never set up, the page is its empty state, with Turn on sign-up.
|
|
18
|
+
|
|
19
|
+
Words: `off`, `directoryRequired`, `anyDomain`, `addDomain`, `add`, `removeDomain`, `domainInvalid`, `domainTwice`,
|
|
20
|
+
`emptyTitle`, `emptyText` and `turnOn` are new; `enabled`, `directory` and `domains` say it as the canvas does;
|
|
21
|
+
`domainsHint` and `save` are gone.
|
|
22
|
+
|
|
3
23
|
## 0.2.0-next.30
|
|
4
24
|
|
|
5
25
|
A prerelease under npm's `next` tag.
|
package/dist/guard.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ interface components {
|
|
|
12
12
|
resetSecondFactor: boolean;
|
|
13
13
|
erase: boolean;
|
|
14
14
|
exportData: boolean;
|
|
15
|
+
deactivate?: boolean;
|
|
16
|
+
activate?: boolean;
|
|
17
|
+
resetPassword?: boolean;
|
|
18
|
+
delete?: boolean;
|
|
15
19
|
};
|
|
16
20
|
AccountDetailDto: {
|
|
17
21
|
account: components["schemas"]["AccountDto"];
|
|
@@ -41,6 +45,9 @@ interface components {
|
|
|
41
45
|
/** @default false */
|
|
42
46
|
isService: boolean;
|
|
43
47
|
isAgent?: boolean;
|
|
48
|
+
invited?: boolean;
|
|
49
|
+
/** Format: date-time */
|
|
50
|
+
createdAt?: string;
|
|
44
51
|
displayNames?: {
|
|
45
52
|
[key: string]: string;
|
|
46
53
|
};
|
|
@@ -151,12 +158,39 @@ interface components {
|
|
|
151
158
|
validUntil: null | string;
|
|
152
159
|
/** Format: date-time */
|
|
153
160
|
createdAt: string;
|
|
161
|
+
code?: null | string;
|
|
162
|
+
/** Format: uuid */
|
|
163
|
+
roleId?: string;
|
|
164
|
+
};
|
|
165
|
+
AnonymousPlaceDto: {
|
|
166
|
+
scopeKey: string;
|
|
167
|
+
label: string;
|
|
168
|
+
code: null | string;
|
|
169
|
+
href: null | string;
|
|
170
|
+
roles: components["schemas"]["AnonymousRoleDto"][];
|
|
171
|
+
};
|
|
172
|
+
AnonymousRoleDto: {
|
|
173
|
+
/** Format: uuid */
|
|
174
|
+
id: string;
|
|
175
|
+
key: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description: null | string;
|
|
178
|
+
names: {
|
|
179
|
+
[key: string]: string;
|
|
180
|
+
};
|
|
181
|
+
descriptions: {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
154
184
|
};
|
|
155
185
|
AppEnrolmentDto: {
|
|
156
186
|
secret: string;
|
|
157
187
|
address: string;
|
|
158
188
|
qr: string;
|
|
159
189
|
};
|
|
190
|
+
ChangeAnonymousRoleInput: {
|
|
191
|
+
/** Format: uuid */
|
|
192
|
+
roleId: string;
|
|
193
|
+
};
|
|
160
194
|
CodeSentDto: {
|
|
161
195
|
method: string;
|
|
162
196
|
to: string;
|
|
@@ -374,6 +408,11 @@ interface components {
|
|
|
374
408
|
ForgotPasswordInput: {
|
|
375
409
|
email: string;
|
|
376
410
|
};
|
|
411
|
+
GiveAnonymousRoleInput: {
|
|
412
|
+
/** Format: uuid */
|
|
413
|
+
roleId: string;
|
|
414
|
+
scopeKey: string;
|
|
415
|
+
};
|
|
377
416
|
GrantDto: {
|
|
378
417
|
/** Format: uuid */
|
|
379
418
|
id: string;
|
|
@@ -441,6 +480,18 @@ interface components {
|
|
|
441
480
|
GroupTwoFactorInput: {
|
|
442
481
|
mode: null | string;
|
|
443
482
|
};
|
|
483
|
+
GuardPagedResultDtoOfAccountDto: {
|
|
484
|
+
groups?: null | components["schemas"]["ListGroupDto"][];
|
|
485
|
+
/** Format: int64 */
|
|
486
|
+
totalCount?: number | string;
|
|
487
|
+
items?: components["schemas"]["AccountDto"][];
|
|
488
|
+
};
|
|
489
|
+
GuardPagedResultDtoOfGroupDto: {
|
|
490
|
+
groups?: null | components["schemas"]["ListGroupDto"][];
|
|
491
|
+
/** Format: int64 */
|
|
492
|
+
totalCount?: number | string;
|
|
493
|
+
items?: components["schemas"]["GroupDto"][];
|
|
494
|
+
};
|
|
444
495
|
IdentityDto: {
|
|
445
496
|
/** Format: uuid */
|
|
446
497
|
directoryId: string;
|
|
@@ -465,6 +516,23 @@ interface components {
|
|
|
465
516
|
removedAt: null | string;
|
|
466
517
|
personalData: components["schemas"]["PluginPersonalData"];
|
|
467
518
|
};
|
|
519
|
+
InvitationInput: {
|
|
520
|
+
people: components["schemas"]["InvitePersonInput"][];
|
|
521
|
+
/** Format: uuid */
|
|
522
|
+
directoryId?: null | string;
|
|
523
|
+
};
|
|
524
|
+
InvitationRefusedDto: {
|
|
525
|
+
email: string;
|
|
526
|
+
reason: string;
|
|
527
|
+
};
|
|
528
|
+
InvitationResultDto: {
|
|
529
|
+
invited: components["schemas"]["AccountDto"][];
|
|
530
|
+
refused: components["schemas"]["InvitationRefusedDto"][];
|
|
531
|
+
};
|
|
532
|
+
InvitePersonInput: {
|
|
533
|
+
email: string;
|
|
534
|
+
displayName?: null | string;
|
|
535
|
+
};
|
|
468
536
|
JsonElement: unknown;
|
|
469
537
|
JsonNode: unknown;
|
|
470
538
|
JsonObject: Record<string, never>;
|
|
@@ -493,6 +561,12 @@ interface components {
|
|
|
493
561
|
/** Format: date-time */
|
|
494
562
|
until: null | string;
|
|
495
563
|
};
|
|
564
|
+
ListGroupDto: {
|
|
565
|
+
key: string;
|
|
566
|
+
label: string;
|
|
567
|
+
/** Format: int32 */
|
|
568
|
+
count: number | string;
|
|
569
|
+
};
|
|
496
570
|
LocalizedText: {
|
|
497
571
|
en: string;
|
|
498
572
|
ar: string;
|
|
@@ -611,16 +685,6 @@ interface components {
|
|
|
611
685
|
email: null | string;
|
|
612
686
|
phone: null | string;
|
|
613
687
|
};
|
|
614
|
-
PagedResultDtoOfAccountDto: {
|
|
615
|
-
/** Format: int64 */
|
|
616
|
-
totalCount?: number | string;
|
|
617
|
-
items?: components["schemas"]["AccountDto"][];
|
|
618
|
-
};
|
|
619
|
-
PagedResultDtoOfGroupDto: {
|
|
620
|
-
/** Format: int64 */
|
|
621
|
-
totalCount?: number | string;
|
|
622
|
-
items?: components["schemas"]["GroupDto"][];
|
|
623
|
-
};
|
|
624
688
|
PasskeyAddedDto: {
|
|
625
689
|
/** Format: uuid */
|
|
626
690
|
id: string;
|
|
@@ -647,6 +711,12 @@ interface components {
|
|
|
647
711
|
PasskeyNameInput: {
|
|
648
712
|
name: null | string;
|
|
649
713
|
};
|
|
714
|
+
PasswordPolicyDto: {
|
|
715
|
+
/** Format: int32 */
|
|
716
|
+
minLength: number | string;
|
|
717
|
+
/** Format: int32 */
|
|
718
|
+
maxLength: number | string;
|
|
719
|
+
};
|
|
650
720
|
PersonalDataField: {
|
|
651
721
|
on: string;
|
|
652
722
|
key: string;
|
|
@@ -1184,8 +1254,8 @@ type SignUpSettingsDto = Schemas['SignUpSettingsDto'];
|
|
|
1184
1254
|
type SignUpSettingsInput = Schemas['SignUpSettingsInput'];
|
|
1185
1255
|
type SignUpDirectoryDto = Schemas['SignUpDirectoryDto'];
|
|
1186
1256
|
type AnonymousGrantDto = Schemas['AnonymousGrantDto'];
|
|
1187
|
-
type AccountPage = Schemas['
|
|
1188
|
-
type GroupPage = Schemas['
|
|
1257
|
+
type AccountPage = Schemas['GuardPagedResultDtoOfAccountDto'];
|
|
1258
|
+
type GroupPage = Schemas['GuardPagedResultDtoOfGroupDto'];
|
|
1189
1259
|
/** A directory's sign-in test, step by step (POST directories/{id}/test-login: its document names no answer). */
|
|
1190
1260
|
type TestLoginStepName = 'Connection' | 'FindUser' | 'Authenticate' | 'Precedence';
|
|
1191
1261
|
interface TestLoginResult {
|
|
@@ -1548,7 +1618,8 @@ interface SignUpScreenProps {
|
|
|
1548
1618
|
* Sign-up, for site admins: off by default. On, people create their own accounts in the internal directory chosen
|
|
1549
1619
|
* here, optionally only with an email in some domains; an account is active once its email is confirmed. Which places
|
|
1550
1620
|
* they may use is a grant like any other, to that directory's "everyone" group. The directories to choose from come
|
|
1551
|
-
* with the settings, so the page works with the Directories feature off.
|
|
1621
|
+
* with the settings, so the page works with the Directories feature off. Edited in place: a change brings the save bar,
|
|
1622
|
+
* and Discard puts back what's saved. Never set up, the page is its empty state, whose button turns sign-up on.
|
|
1552
1623
|
*/
|
|
1553
1624
|
declare function SignUpScreen({ directoriesPage }?: SignUpScreenProps): react.JSX.Element;
|
|
1554
1625
|
|
package/dist/guard.js
CHANGED
|
@@ -202,15 +202,13 @@ var ar_default = {
|
|
|
202
202
|
"groupDetail.saveNames": "\u0627\u062D\u0641\u0638 \u0627\u0644\u0623\u0633\u0645\u0627\u0621",
|
|
203
203
|
"signUpSettings.title": "\u0627\u0644\u062A\u0633\u062C\u064A\u0644",
|
|
204
204
|
"signUpSettings.subtitle": "\u0647\u0644 \u064A\u0645\u0643\u0646 \u0644\u0644\u0646\u0627\u0633 \u0625\u0646\u0634\u0627\u0621 \u062D\u0633\u0627\u0628\u0627\u062A\u0647\u0645 \u0628\u0623\u0646\u0641\u0633\u0647\u0645. \u064A\u0624\u0643\u062F\u0648\u0646 \u0628\u0631\u064A\u062F\u0647\u0645 \u0623\u0648\u0644\u064B\u0627\u061B \u0648\u0645\u0627 \u064A\u0645\u0643\u0646\u0647\u0645 \u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647 \u062A\u062D\u062F\u062F\u0647 \u0627\u0644\u0623\u062F\u0648\u0627\u0631 \u0627\u0644\u062A\u064A \u062A\u0645\u0646\u062D\u0647\u0627.",
|
|
205
|
-
"signUpSettings.enabled": "\u064A\u0645\u0643\u0646 \u0644\u0644\u0646\u0627\u0633 \u0627\
|
|
206
|
-
"signUpSettings.directory": "\u0627\u0644\
|
|
205
|
+
"signUpSettings.enabled": "\u064A\u0645\u0643\u0646 \u0644\u0644\u0646\u0627\u0633 \u0625\u0646\u0634\u0627\u0621 \u062D\u0633\u0627\u0628\u0627\u062A\u0647\u0645 \u0628\u0623\u0646\u0641\u0633\u0647\u0645",
|
|
206
|
+
"signUpSettings.directory": "\u062A\u064F\u0646\u0634\u0623 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0641\u064A",
|
|
207
207
|
"signUpSettings.directoryHint": "\u062A\u064F\u0646\u0634\u0623 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u062F\u0644\u064A\u0644 \u0627\u0644\u062F\u0627\u062E\u0644\u064A. \u0623\u0636\u0641 \u062F\u0644\u064A\u0644\u064B\u0627 \u0645\u062B\u0644 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0645\u0646 \u0627\u0644\u0623\u062F\u0644\u0629.",
|
|
208
208
|
"signUpSettings.directoryHintPlain": "\u062A\u064F\u0646\u0634\u0623 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u062F\u0644\u064A\u0644 \u0627\u0644\u062F\u0627\u062E\u0644\u064A.",
|
|
209
209
|
"signUpSettings.chooseDirectory": "\u0627\u062E\u062A\u0631 \u062F\u0644\u064A\u0644\u064B\u0627",
|
|
210
|
-
"signUpSettings.domains": "\u0646\u0637\u0627\u0642\u0627\u062A \u0627\u0644\u0628\u0631\u064A\u062F",
|
|
211
|
-
"signUpSettings.domainsHint": "\u0644\u0627 \u064A\u0633\u062C\u0644 \u0625\u0644\u0627 \u0623\u0635\u062D\u0627\u0628 \u0647\u0630\u0647 \u0627\u0644\u0646\u0637\u0627\u0642\u0627\u062A\u061B \u0627\u0644\u0641\u0627\u0631\u063A \u064A\u0642\u0628\u0644 \u0623\u064A\u064B\u0627 \u0645\u0646\u0647\u0627. \u0627\u0641\u0635\u0644 \u0628\u064A\u0646\u0647\u0627 \u0628\u0641\u0648\u0627\u0635\u0644.",
|
|
210
|
+
"signUpSettings.domains": "\u0646\u0637\u0627\u0642\u0627\u062A \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0645\u0633\u0645\u0648\u062D\u0629",
|
|
212
211
|
"signUpSettings.grantHint": "\u0644\u062A\u0645\u0646\u062D \u0627\u0644\u0645\u0633\u062C\u0651\u0644\u064A\u0646 \u0645\u0634\u0631\u0648\u0639\u064B\u0627\u060C \u0627\u0645\u0646\u062D \u062F\u0648\u0631 \u0627\u0644\u0639\u0645\u064A\u0644 \u0641\u064A\u0647 \u0644\u0644\u0645\u062C\u0645\u0648\u0639\u0629 {group} \u0645\u0646 \u0623\u0639\u0636\u0627\u0621 \u0627\u0644\u0645\u0634\u0631\u0648\u0639.",
|
|
213
|
-
"signUpSettings.save": "\u062D\u0641\u0638",
|
|
214
212
|
"signUpSettings.saved": "\u062D\u064F\u0641\u0638 \u0627\u0644\u062A\u0633\u062C\u064A\u0644.",
|
|
215
213
|
"anonymousAccess.title": "\u0627\u0644\u0648\u0635\u0648\u0644 \u0627\u0644\u0645\u062C\u0647\u0648\u0644",
|
|
216
214
|
"anonymousAccess.subtitle": "\u0643\u0644 \u062F\u0648\u0631 \u0645\u064F\u0646\u062D \u0644\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646. \u064A\u062D\u0635\u0644 \u0639\u0644\u064A\u0647\u0627 \u0623\u064A \u0634\u062E\u0635 \u0639\u0644\u0649 \u0627\u0644\u0625\u0646\u062A\u0631\u0646\u062A\u060C \u0641\u0623\u0628\u0642\u0647\u0627 \u0642\u0644\u064A\u0644\u0629.",
|
|
@@ -431,7 +429,18 @@ var ar_default = {
|
|
|
431
429
|
"secondFactor.required.title": "\u0623\u0639\u062F\u0651 \u0645\u0641\u062A\u0627\u062D \u0645\u0631\u0648\u0631 \u0623\u0648 \u062A\u0637\u0628\u064A\u0642 \u0645\u0635\u0627\u062F\u0642\u0629",
|
|
432
430
|
"secondFactor.required.by": "\u064A\u062D\u062A\u0627\u062C \u0645\u062F\u064A\u0631\u0648 \u0627\u0644\u0645\u0648\u0642\u0639 \u0625\u0644\u0649 \u0623\u062D\u062F\u0647\u0645\u0627. \u0623\u0639\u062F\u0651\u0647 \u0642\u0628\u0644 {date}\u061B \u0628\u0639\u062F \u0630\u0644\u0643 \u064A\u0637\u0644\u0628\u0647 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0623\u0648\u0644\u064B\u0627.",
|
|
433
431
|
"secondFactor.required.overdue": "\u064A\u062D\u062A\u0627\u062C \u0645\u062F\u064A\u0631\u0648 \u0627\u0644\u0645\u0648\u0642\u0639 \u0625\u0644\u0649 \u0623\u062D\u062F\u0647\u0645\u0627\u060C \u0648\u0642\u062F \u0645\u0636\u0649 \u0627\u0644\u0645\u0648\u0639\u062F: \u0623\u0639\u062F\u0651\u0647 \u0627\u0644\u0622\u0646.",
|
|
434
|
-
"secondFactor.required.setUp": "\u0623\u0639\u062F\u0651\u0647"
|
|
432
|
+
"secondFactor.required.setUp": "\u0623\u0639\u062F\u0651\u0647",
|
|
433
|
+
"signUpSettings.off": "\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0645\u062A\u0648\u0642\u0641. \u0644\u0627 \u064A\u0646\u0634\u0626 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A \u0625\u0644\u0627 \u0627\u0644\u0645\u0633\u0624\u0648\u0644\u0648\u0646 \u0645\u0646 \u0635\u0641\u062D\u0629 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A.",
|
|
434
|
+
"signUpSettings.directoryRequired": "\u0627\u062E\u062A\u0631 \u0627\u0644\u062F\u0644\u064A\u0644 \u0627\u0644\u0630\u064A \u062A\u064F\u0646\u0634\u0623 \u0641\u064A\u0647 \u0627\u0644\u062D\u0633\u0627\u0628\u0627\u062A.",
|
|
435
|
+
"signUpSettings.anyDomain": "\u0623\u064A \u0646\u0637\u0627\u0642. \u064A\u0645\u0643\u0646 \u0644\u0623\u064A \u0628\u0631\u064A\u062F \u0627\u0644\u062A\u0633\u062C\u064A\u0644.",
|
|
436
|
+
"signUpSettings.addDomain": "\u0625\u0636\u0627\u0641\u0629 \u0646\u0637\u0627\u0642",
|
|
437
|
+
"signUpSettings.add": "\u0625\u0636\u0627\u0641\u0629",
|
|
438
|
+
"signUpSettings.removeDomain": "\u0625\u0632\u0627\u0644\u0629 {domain}",
|
|
439
|
+
"signUpSettings.domainInvalid": "\u0623\u062F\u062E\u0644 \u0646\u0637\u0627\u0642\u064B\u0627 \u0645\u062B\u0644 acme.com.",
|
|
440
|
+
"signUpSettings.domainTwice": "{domain} \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0627\u0644\u0642\u0627\u0626\u0645\u0629.",
|
|
441
|
+
"signUpSettings.emptyTitle": "\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0645\u062A\u0648\u0642\u0641",
|
|
442
|
+
"signUpSettings.emptyText": "\u0627\u0644\u0645\u062F\u064A\u0631\u0648\u0646 \u0641\u0642\u0637 \u064A\u0636\u064A\u0641\u0648\u0646 \u0627\u0644\u0623\u0634\u062E\u0627\u0635 \u0627\u0644\u0622\u0646. \u064A\u0645\u0643\u0646\u0643 \u0627\u0644\u0633\u0645\u0627\u062D \u0644\u0644\u0646\u0627\u0633 \u0628\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0628\u0623\u0646\u0641\u0633\u0647\u0645.",
|
|
443
|
+
"signUpSettings.turnOn": "\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644"
|
|
435
444
|
};
|
|
436
445
|
|
|
437
446
|
// src/areas/guard/texts/en.json
|
|
@@ -627,15 +636,13 @@ var en_default = {
|
|
|
627
636
|
"groupDetail.saveNames": "Save names",
|
|
628
637
|
"signUpSettings.title": "Sign-up",
|
|
629
638
|
"signUpSettings.subtitle": "Whether people may create their own accounts. They confirm their email first; what they may use is up to the roles you grant.",
|
|
630
|
-
"signUpSettings.enabled": "People
|
|
631
|
-
"signUpSettings.directory": "
|
|
639
|
+
"signUpSettings.enabled": "People can create their own accounts",
|
|
640
|
+
"signUpSettings.directory": "New accounts go to",
|
|
632
641
|
"signUpSettings.directoryHint": "Sign-ups are created in this internal directory. Add one such as Customers under Directories.",
|
|
633
642
|
"signUpSettings.directoryHintPlain": "Sign-ups are created in this internal directory.",
|
|
634
643
|
"signUpSettings.chooseDirectory": "Choose a directory",
|
|
635
|
-
"signUpSettings.domains": "
|
|
636
|
-
"signUpSettings.domainsHint": "Only these domains may sign up; empty takes any. Separate them with commas.",
|
|
644
|
+
"signUpSettings.domains": "Allowed email domains",
|
|
637
645
|
"signUpSettings.grantHint": "To give sign-ups a project, grant its Customer role to the group {group} in the project\u2019s members.",
|
|
638
|
-
"signUpSettings.save": "Save",
|
|
639
646
|
"signUpSettings.saved": "Sign-up saved.",
|
|
640
647
|
"anonymousAccess.title": "Anonymous access",
|
|
641
648
|
"anonymousAccess.subtitle": "Every role given to anonymous visitors. Anyone on the internet gets these, so keep them few.",
|
|
@@ -856,7 +863,18 @@ var en_default = {
|
|
|
856
863
|
"secondFactor.required.title": "Set up a passkey or an authenticator app",
|
|
857
864
|
"secondFactor.required.by": "Site admins need one. Set it up by {date}; after that, signing in asks you to first.",
|
|
858
865
|
"secondFactor.required.overdue": "Site admins need one, and the date has passed: set it up now.",
|
|
859
|
-
"secondFactor.required.setUp": "Set it up"
|
|
866
|
+
"secondFactor.required.setUp": "Set it up",
|
|
867
|
+
"signUpSettings.off": "Sign-up is off. Only admins create accounts, from Accounts.",
|
|
868
|
+
"signUpSettings.directoryRequired": "Choose where new accounts go.",
|
|
869
|
+
"signUpSettings.anyDomain": "Any domain. Anyone with an email can sign up.",
|
|
870
|
+
"signUpSettings.addDomain": "Add domain",
|
|
871
|
+
"signUpSettings.add": "Add",
|
|
872
|
+
"signUpSettings.removeDomain": "Remove {domain}",
|
|
873
|
+
"signUpSettings.domainInvalid": "Enter a domain such as acme.com.",
|
|
874
|
+
"signUpSettings.domainTwice": "{domain} is in the list already.",
|
|
875
|
+
"signUpSettings.emptyTitle": "Sign-up is off",
|
|
876
|
+
"signUpSettings.emptyText": "Only admins can add people now. You can let people sign themselves up.",
|
|
877
|
+
"signUpSettings.turnOn": "Turn on sign-up"
|
|
860
878
|
};
|
|
861
879
|
|
|
862
880
|
// src/areas/guard/texts.ts
|
|
@@ -3471,55 +3489,234 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3471
3489
|
import { useSyncExternalStore } from "react";
|
|
3472
3490
|
|
|
3473
3491
|
// src/areas/guard/SignUpScreen.tsx
|
|
3474
|
-
import { useEffect as useEffect5, useState as useState14 } from "react";
|
|
3475
|
-
import { HStack as HStack18, Input as Input10, Stack as Stack16 } from "@chakra-ui/react";
|
|
3476
|
-
import {
|
|
3477
|
-
import {
|
|
3492
|
+
import { useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2, useState as useState14 } from "react";
|
|
3493
|
+
import { Grid as Grid4, HStack as HStack18, Input as Input10, Stack as Stack16, Text as Text19 } from "@chakra-ui/react";
|
|
3494
|
+
import { Trash2 as Trash22 } from "lucide-react";
|
|
3495
|
+
import {
|
|
3496
|
+
AddButton,
|
|
3497
|
+
Button as Button15,
|
|
3498
|
+
EmptyState,
|
|
3499
|
+
Field as Field9,
|
|
3500
|
+
IconButton as IconButton4,
|
|
3501
|
+
InlineAlert as InlineAlert16,
|
|
3502
|
+
notify as notify12,
|
|
3503
|
+
PageHeader as PageHeader9,
|
|
3504
|
+
Panel as Panel15,
|
|
3505
|
+
SaveBar,
|
|
3506
|
+
SelectField as SelectField4,
|
|
3507
|
+
SwitchField,
|
|
3508
|
+
useApiAction as useApiAction10,
|
|
3509
|
+
useApiQuery as useApiQuery12,
|
|
3510
|
+
useAreaRequest as useAreaRequest16
|
|
3511
|
+
} from "@abpjs/ui";
|
|
3512
|
+
|
|
3513
|
+
// src/areas/guard/signUpRules.ts
|
|
3514
|
+
var DOMAIN = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,61}[a-z0-9]$/;
|
|
3515
|
+
function normalDomain(typed) {
|
|
3516
|
+
const d = typed.trim().replace(/^@/, "").replace(/\.$/, "").toLowerCase();
|
|
3517
|
+
return DOMAIN.test(d) ? d : null;
|
|
3518
|
+
}
|
|
3519
|
+
function signUpChanges(saved, form) {
|
|
3520
|
+
const was = new Set(saved.domains);
|
|
3521
|
+
const now = new Set(form.domains);
|
|
3522
|
+
return Number(saved.enabled !== form.enabled) + Number(saved.directoryId !== form.directoryId) + form.domains.filter((d) => !was.has(d)).length + saved.domains.filter((d) => !now.has(d)).length;
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
// src/areas/guard/SignUpScreen.tsx
|
|
3478
3526
|
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3527
|
+
function fromSettings(s) {
|
|
3528
|
+
return { enabled: s.enabled, directoryId: s.directoryId ?? "", domains: [...s.emailDomains] };
|
|
3529
|
+
}
|
|
3479
3530
|
function SignUpScreen({ directoriesPage = true } = {}) {
|
|
3480
3531
|
const t = useGuardNs("signUpSettings");
|
|
3481
3532
|
const request = useAreaRequest16("guard");
|
|
3482
3533
|
const settings = useApiQuery12("guard", "/signup/settings");
|
|
3483
3534
|
const action = useApiAction10();
|
|
3484
|
-
const [form, setForm] = useState14({ enabled: false, directoryId: "", domains:
|
|
3535
|
+
const [form, setForm] = useState14({ enabled: false, directoryId: "", domains: [] });
|
|
3536
|
+
const [started, setStarted] = useState14(false);
|
|
3537
|
+
const [adding, setAdding] = useState14(false);
|
|
3538
|
+
const [draft, setDraft] = useState14("");
|
|
3539
|
+
const [draftError, setDraftError] = useState14("");
|
|
3540
|
+
const [directoryError, setDirectoryError] = useState14("");
|
|
3541
|
+
const addButton = useRef2(null);
|
|
3542
|
+
const draftInput = useRef2(null);
|
|
3485
3543
|
useEffect5(() => {
|
|
3486
|
-
|
|
3487
|
-
if (s) setForm({ enabled: s.enabled, directoryId: s.directoryId ?? "", domains: s.emailDomains.join(", ") });
|
|
3544
|
+
if (settings.data) setForm(fromSettings(settings.data));
|
|
3488
3545
|
}, [settings.data]);
|
|
3546
|
+
const saved = useMemo2(() => settings.data ? fromSettings(settings.data) : form, [settings.data, form]);
|
|
3547
|
+
const changes = settings.data ? signUpChanges(saved, form) + Number(draft.trim() !== "") : 0;
|
|
3489
3548
|
if (settings.error) return /* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: settings.error });
|
|
3490
3549
|
const listed = settings.data?.directories ?? [];
|
|
3491
3550
|
const current = settings.data?.directoryId;
|
|
3492
3551
|
const internal = current && !listed.some((d) => d.id === current) && settings.data?.directoryName ? [...listed, { id: current, name: settings.data.directoryName }] : listed;
|
|
3493
3552
|
const chosen = internal.find((d) => d.id === form.directoryId);
|
|
3553
|
+
const neverSetUp = !!settings.data && !settings.data.enabled && !settings.data.directoryId && settings.data.emailDomains.length === 0;
|
|
3554
|
+
function change(next) {
|
|
3555
|
+
setForm((f) => ({ ...f, ...next }));
|
|
3556
|
+
action.setError(null);
|
|
3557
|
+
}
|
|
3558
|
+
function addDraft() {
|
|
3559
|
+
const domain = normalDomain(draft);
|
|
3560
|
+
if (!domain) {
|
|
3561
|
+
setDraftError(t("domainInvalid"));
|
|
3562
|
+
return;
|
|
3563
|
+
}
|
|
3564
|
+
if (form.domains.includes(domain)) {
|
|
3565
|
+
setDraftError(t("domainTwice", { domain }));
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
change({ domains: [...form.domains, domain] });
|
|
3569
|
+
setDraft("");
|
|
3570
|
+
setDraftError("");
|
|
3571
|
+
draftInput.current?.focus();
|
|
3572
|
+
}
|
|
3573
|
+
function closeDraft() {
|
|
3574
|
+
setAdding(false);
|
|
3575
|
+
setDraft("");
|
|
3576
|
+
setDraftError("");
|
|
3577
|
+
requestAnimationFrame(() => addButton.current?.focus());
|
|
3578
|
+
}
|
|
3579
|
+
function onDraftKey(e) {
|
|
3580
|
+
if (e.key === "Enter") {
|
|
3581
|
+
e.preventDefault();
|
|
3582
|
+
addDraft();
|
|
3583
|
+
} else if (e.key === "Escape") {
|
|
3584
|
+
e.preventDefault();
|
|
3585
|
+
closeDraft();
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
function discard() {
|
|
3589
|
+
if (settings.data) setForm(fromSettings(settings.data));
|
|
3590
|
+
setStarted(false);
|
|
3591
|
+
setDirectoryError("");
|
|
3592
|
+
closeDraft();
|
|
3593
|
+
action.setError(null);
|
|
3594
|
+
}
|
|
3494
3595
|
async function save() {
|
|
3495
|
-
|
|
3596
|
+
let domains = form.domains;
|
|
3597
|
+
if (draft.trim()) {
|
|
3598
|
+
const domain = normalDomain(draft);
|
|
3599
|
+
if (!domain) {
|
|
3600
|
+
setDraftError(t("domainInvalid"));
|
|
3601
|
+
draftInput.current?.focus();
|
|
3602
|
+
return;
|
|
3603
|
+
}
|
|
3604
|
+
if (!domains.includes(domain)) domains = [...domains, domain];
|
|
3605
|
+
}
|
|
3606
|
+
if (form.enabled && !form.directoryId) {
|
|
3607
|
+
setDirectoryError(t("directoryRequired"));
|
|
3608
|
+
return;
|
|
3609
|
+
}
|
|
3610
|
+
const result = await action.run(
|
|
3496
3611
|
() => request("/signup/settings", {
|
|
3497
3612
|
method: "PUT",
|
|
3498
|
-
body: { enabled: form.enabled, directoryId: form.directoryId || null, emailDomains:
|
|
3613
|
+
body: { enabled: form.enabled, directoryId: form.directoryId || null, emailDomains: domains }
|
|
3499
3614
|
})
|
|
3500
3615
|
);
|
|
3501
|
-
if (
|
|
3502
|
-
settings.setData(
|
|
3616
|
+
if (result) {
|
|
3617
|
+
settings.setData(result);
|
|
3618
|
+
setStarted(false);
|
|
3619
|
+
closeDraft();
|
|
3503
3620
|
notify12.success(t("saved"));
|
|
3504
3621
|
}
|
|
3505
3622
|
}
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
/* @__PURE__ */ jsx20(
|
|
3510
|
-
/* @__PURE__ */ jsx20(
|
|
3511
|
-
|
|
3623
|
+
const saveBar = /* @__PURE__ */ jsx20(SaveBar, { open: changes > 0, count: changes, onSave: () => void save(), onDiscard: discard, busy: action.busy });
|
|
3624
|
+
if (neverSetUp && !started && changes === 0) {
|
|
3625
|
+
return /* @__PURE__ */ jsxs20(Stack16, { gap: "section", children: [
|
|
3626
|
+
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3627
|
+
/* @__PURE__ */ jsx20(
|
|
3628
|
+
EmptyState,
|
|
3512
3629
|
{
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3630
|
+
variant: "page",
|
|
3631
|
+
size: "md",
|
|
3632
|
+
kind: "first-use",
|
|
3633
|
+
illustration: "records",
|
|
3634
|
+
title: t("emptyTitle"),
|
|
3635
|
+
description: t("emptyText"),
|
|
3636
|
+
action: /* @__PURE__ */ jsx20(Button15, { variant: "primary", onClick: () => {
|
|
3637
|
+
setStarted(true);
|
|
3638
|
+
change({ enabled: true });
|
|
3639
|
+
}, children: t("turnOn") })
|
|
3516
3640
|
}
|
|
3517
|
-
)
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3641
|
+
)
|
|
3642
|
+
] });
|
|
3643
|
+
}
|
|
3644
|
+
return /* @__PURE__ */ jsxs20(Stack16, { gap: "section", children: [
|
|
3645
|
+
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3646
|
+
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(Stack16, { gap: "5", children: [
|
|
3647
|
+
/* @__PURE__ */ jsx20(SwitchField, { label: t("enabled"), checked: form.enabled, onCheckedChange: (c) => {
|
|
3648
|
+
change({ enabled: c });
|
|
3649
|
+
if (!c) setDirectoryError("");
|
|
3650
|
+
} }),
|
|
3651
|
+
form.enabled ? /* @__PURE__ */ jsxs20(Grid4, { templateColumns: { base: "minmax(0, 1fr)", md: "repeat(2, minmax(0, 1fr))" }, gap: { base: "5", md: "4 8" }, alignItems: "start", children: [
|
|
3652
|
+
/* @__PURE__ */ jsx20(
|
|
3653
|
+
Field9,
|
|
3654
|
+
{
|
|
3655
|
+
label: t("directory"),
|
|
3656
|
+
required: true,
|
|
3657
|
+
invalid: !!directoryError,
|
|
3658
|
+
errorText: directoryError,
|
|
3659
|
+
helperText: chosen ? t("grantHint", { group: `${chosen.name} (everyone)` }) : directoriesPage ? t("directoryHint") : t("directoryHintPlain"),
|
|
3660
|
+
children: /* @__PURE__ */ jsx20(
|
|
3661
|
+
SelectField4,
|
|
3662
|
+
{
|
|
3663
|
+
value: form.directoryId,
|
|
3664
|
+
onChange: (e) => {
|
|
3665
|
+
change({ directoryId: e.target.value });
|
|
3666
|
+
setDirectoryError("");
|
|
3667
|
+
},
|
|
3668
|
+
options: [{ value: "", label: t("chooseDirectory") }, ...internal.map((d) => ({ value: d.id, label: d.name }))]
|
|
3669
|
+
}
|
|
3670
|
+
)
|
|
3671
|
+
}
|
|
3672
|
+
),
|
|
3673
|
+
/* @__PURE__ */ jsxs20(Stack16, { gap: "2", minW: "0", role: "group", "aria-labelledby": "signup-domains", children: [
|
|
3674
|
+
/* @__PURE__ */ jsx20(Text19, { id: "signup-domains", textStyle: "label", children: t("domains") }),
|
|
3675
|
+
/* @__PURE__ */ jsxs20(Stack16, { gap: "1", children: [
|
|
3676
|
+
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(Text19, { textStyle: "body.sm", color: "fg.muted", py: "1.5", children: t("anyDomain") }),
|
|
3677
|
+
form.domains.map((d) => /* @__PURE__ */ jsxs20(HStack18, { gap: "2", minH: "11", ps: "3", pe: "1", borderRadius: "l2", bg: "bg.subtle", textStyle: "body.sm", children: [
|
|
3678
|
+
/* @__PURE__ */ jsx20(Text19, { flex: "1", minW: "0", fontWeight: "bold", dir: "ltr", textAlign: "start", truncate: true, children: d }),
|
|
3679
|
+
/* @__PURE__ */ jsx20(
|
|
3680
|
+
IconButton4,
|
|
3681
|
+
{
|
|
3682
|
+
remove: true,
|
|
3683
|
+
size: "sm",
|
|
3684
|
+
"aria-label": t("removeDomain", { domain: d }),
|
|
3685
|
+
onClick: () => change({ domains: form.domains.filter((x) => x !== d) }),
|
|
3686
|
+
children: /* @__PURE__ */ jsx20(Trash22, {})
|
|
3687
|
+
}
|
|
3688
|
+
)
|
|
3689
|
+
] }, d))
|
|
3690
|
+
] }),
|
|
3691
|
+
adding ? /* @__PURE__ */ jsx20(Field9, { invalid: !!draftError, errorText: draftError, children: /* @__PURE__ */ jsxs20(HStack18, { gap: "3", align: "center", w: "full", children: [
|
|
3692
|
+
/* @__PURE__ */ jsx20(
|
|
3693
|
+
Input10,
|
|
3694
|
+
{
|
|
3695
|
+
ref: draftInput,
|
|
3696
|
+
autoFocus: true,
|
|
3697
|
+
"aria-label": t("addDomain"),
|
|
3698
|
+
value: draft,
|
|
3699
|
+
dir: "ltr",
|
|
3700
|
+
placeholder: "acme.com",
|
|
3701
|
+
maxW: { md: "20rem" },
|
|
3702
|
+
flex: "1",
|
|
3703
|
+
onChange: (e) => {
|
|
3704
|
+
setDraft(e.target.value);
|
|
3705
|
+
setDraftError("");
|
|
3706
|
+
},
|
|
3707
|
+
onKeyDown: onDraftKey,
|
|
3708
|
+
onBlur: () => {
|
|
3709
|
+
if (!draft.trim()) closeDraft();
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
),
|
|
3713
|
+
/* @__PURE__ */ jsx20(AddButton, { onMouseDown: (e) => e.preventDefault(), onClick: addDraft, children: t("add") })
|
|
3714
|
+
] }) }) : /* @__PURE__ */ jsx20(AddButton, { ref: addButton, alignSelf: "flex-start", onClick: () => setAdding(true), children: t("addDomain") })
|
|
3715
|
+
] })
|
|
3716
|
+
] }) : /* @__PURE__ */ jsx20(Text19, { textStyle: "body.sm", color: "fg.muted", children: t("off") }),
|
|
3717
|
+
/* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: action.error })
|
|
3718
|
+
] }) }),
|
|
3719
|
+
saveBar
|
|
3523
3720
|
] });
|
|
3524
3721
|
}
|
|
3525
3722
|
|