Skip to content

Commit 6ec8451

Browse files
audreyalityjaasen-livefront
authored andcommitted
[PM-13876] replace angular validation with html constraints validation (#11816)
* rough-in passphrase validation failure handling * trigger valid change from settings * fix `max` constraint enforcement * add taps for generator validation monitoring/debugging * HTML constraints validation rises like a phoenix * remove min/max boundaries to fix chrome display issue * bind settings components as view children of options components * remove defunct `okSettings$` * extend validationless generator to passwords * extend validationless generator to catchall emails * extend validationless generator to forwarder emails * extend validationless generator to subaddress emails * extend validationless generator to usernames * fix observable cycle * disable generate button when no algorithm is selected * prevent duplicate algorithm emissions * add constraints that assign email address defaults
1 parent 0c18312 commit 6ec8451

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

libs/tools/generator/components/src/catchall-settings.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import {
1212

1313
import { completeOnAccountSwitch } from "./util";
1414

15+
/** Splits an email into a username, subaddress, and domain named group.
16+
* Subaddress is optional.
17+
*/
18+
export const DOMAIN_PARSER = new RegExp("[^@]+@(?<domain>.+)");
19+
1520
/** Options group for catchall emails */
1621
@Component({
1722
selector: "tools-catchall-settings",

libs/tools/generator/components/src/credential-generator.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@
3939
</div>
4040
</bit-card>
4141
<tools-password-settings
42+
#passwordSettings
4243
class="tw-mt-6"
4344
*ngIf="(showAlgorithm$ | async)?.id === 'password'"
4445
[userId]="userId$ | async"
4546
(onUpdated)="generate('password settings')"
4647
/>
4748
<tools-passphrase-settings
49+
#passphraseSettings
4850
class="tw-mt-6"
4951
*ngIf="(showAlgorithm$ | async)?.id === 'passphrase'"
5052
[userId]="userId$ | async"
@@ -82,21 +84,25 @@ <h2 bitTypography="h6">{{ "options" | i18n }}</h2>
8284
</bit-form-field>
8385
</form>
8486
<tools-catchall-settings
87+
#catchallSettings
8588
*ngIf="(showAlgorithm$ | async)?.id === 'catchall'"
8689
[userId]="userId$ | async"
8790
(onUpdated)="generate('catchall settings')"
8891
/>
8992
<tools-forwarder-settings
93+
#forwarderSettings
9094
*ngIf="!!(forwarderId$ | async)"
9195
[forwarder]="forwarderId$ | async"
9296
[userId]="this.userId$ | async"
9397
/>
9498
<tools-subaddress-settings
99+
#subaddressSettings
95100
*ngIf="(showAlgorithm$ | async)?.id === 'subaddress'"
96101
[userId]="userId$ | async"
97102
(onUpdated)="generate('subaddress settings')"
98103
/>
99104
<tools-username-settings
105+
#usernameSettings
100106
*ngIf="(showAlgorithm$ | async)?.id === 'username'"
101107
[userId]="userId$ | async"
102108
(onUpdated)="generate('username settings')"

libs/tools/generator/components/src/password-generator.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@
3737
</div>
3838
</bit-card>
3939
<tools-password-settings
40+
#passwordSettings
4041
class="tw-mt-6"
4142
*ngIf="(algorithm$ | async)?.id === 'password'"
4243
[userId]="this.userId$ | async"
4344
[disableMargin]="disableMargin"
4445
(onUpdated)="generate('password settings')"
4546
/>
4647
<tools-passphrase-settings
48+
#passphraseSettings
4749
class="tw-mt-6"
4850
*ngIf="(algorithm$ | async)?.id === 'passphrase'"
4951
[userId]="this.userId$ | async"

libs/tools/generator/components/src/username-generator.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,25 @@ <h2 bitTypography="h6">{{ "options" | i18n }}</h2>
5959
</bit-form-field>
6060
</form>
6161
<tools-catchall-settings
62+
#catchallSettings
6263
*ngIf="(algorithm$ | async)?.id === 'catchall'"
6364
[userId]="this.userId$ | async"
6465
(onUpdated)="generate('catchall settings')"
6566
/>
6667
<tools-forwarder-settings
68+
#forwarderSettings
6769
*ngIf="!!(forwarderId$ | async)"
6870
[forwarder]="forwarderId$ | async"
6971
[userId]="this.userId$ | async"
7072
/>
7173
<tools-subaddress-settings
74+
#subaddressSettings
7275
*ngIf="(algorithm$ | async)?.id === 'subaddress'"
7376
[userId]="this.userId$ | async"
7477
(onUpdated)="generate('subaddress settings')"
7578
/>
7679
<tools-username-settings
80+
#usernameSettings
7781
*ngIf="(algorithm$ | async)?.id === 'username'"
7882
[userId]="this.userId$ | async"
7983
(onUpdated)="generate('username settings')"

0 commit comments

Comments
 (0)