@nymphjs/tilmeld-setup 1.0.0-beta.44 → 1.0.0-beta.46

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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
7
+
8
+ ### Features
9
+
10
+ - enable tilmeld admins to remove totp secret from users ([18455b3](https://github.com/sciactive/nymphjs/commit/18455b3edbbfa1188f8cf317438bbfa028ba8f47))
11
+
12
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
13
+
14
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
15
+
6
16
  # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
7
17
 
8
18
  **Note:** Version bump only for package @nymphjs/tilmeld-setup
@@ -462,8 +462,11 @@
462
462
  {#if activeTab === 'Security'}
463
463
  <LayoutGrid style="padding: 0;">
464
464
  <LayoutCell span={12}>
465
- The email verification secret is the code emailed to the user to
466
- verify their address when they first sign up.
465
+ <h5>Verification</h5>
466
+ <p>
467
+ The email verification secret is the code emailed to the user to
468
+ verify their address when they first sign up.
469
+ </p>
467
470
  </LayoutCell>
468
471
  <LayoutCell span={12}>
469
472
  <Textfield
@@ -475,9 +478,12 @@
475
478
  />
476
479
  </LayoutCell>
477
480
  <LayoutCell span={12}>
478
- The account recovery secret is the code emailed to the user to allow
479
- them to change their password and recover their account. The date is
480
- used to determine if the code has expired.
481
+ <h5>Account Recovery</h5>
482
+ <p>
483
+ The account recovery secret is the code emailed to the user to allow
484
+ them to change their password and recover their account. The date is
485
+ used to determine if the code has expired.
486
+ </p>
481
487
  </LayoutCell>
482
488
  <LayoutCell span={6}>
483
489
  <Textfield
@@ -505,13 +511,16 @@
505
511
  </Textfield>
506
512
  </LayoutCell>
507
513
  <LayoutCell span={12}>
508
- An email change uses all of the following properties. The email change
509
- date is used to rate limit email changes and to allow the user to
510
- cancel the change within the rate limit time. The new secret is
511
- emailed to the new address, and when the user clicks the link, that
512
- email address is set for their account. The cancel secret is emailed
513
- to the old address and will reset the user's email to the cancel
514
- address if the link is clicked in time.
514
+ <h5>Email Change</h5>
515
+ <p>
516
+ An email change uses all of the following properties. The email
517
+ change date is used to rate limit email changes and to allow the
518
+ user to cancel the change within the rate limit time. The new secret
519
+ is emailed to the new address, and when the user clicks the link,
520
+ that email address is set for their account. The cancel secret is
521
+ emailed to the old address and will reset the user's email to the
522
+ cancel address if the link is clicked in time.
523
+ </p>
515
524
  </LayoutCell>
516
525
  <LayoutCell span={12}>
517
526
  <Textfield
@@ -565,11 +574,14 @@
565
574
  />
566
575
  </LayoutCell>
567
576
  <LayoutCell span={12}>
568
- The token revocation date is the date that all authentication tokens
569
- must be issued after in order to work. Any token issued before this
570
- date will be denied access. You can set this to now to log the user
571
- out of all of their current sessions. The user will have to log in
572
- again with their password.
577
+ <h5>Auth Token Revocation</h5>
578
+ <p>
579
+ The token revocation date is the date that all authentication tokens
580
+ must be issued after in order to work. Any token issued before this
581
+ date will be denied access. You can set this to now to log the user
582
+ out of all of their current sessions. The user will have to log in
583
+ again with their password.
584
+ </p>
573
585
  </LayoutCell>
574
586
  <LayoutCell span={12}>
575
587
  <div style="display: flex; gap: 1em; align-items: center;">
@@ -594,6 +606,26 @@
594
606
  </Button>
595
607
  </div>
596
608
  </LayoutCell>
609
+ <LayoutCell span={12}>
610
+ <h5>Two Factor Authentication</h5>
611
+ <p>
612
+ 2FA is an extra security measure that requires the user to have both
613
+ their password and a code generator device (usually an app on their
614
+ phone) to successfully authenticate.
615
+ </p>
616
+ </LayoutCell>
617
+ <LayoutCell span={12}>
618
+ <div style="display: inline-flex; gap: 1em; align-items: baseline;">
619
+ <span>
620
+ Has 2FA secret: {hasTOTPSecret ? 'Yes' : 'No'}
621
+ </span>
622
+ {#if hasTOTPSecret}
623
+ <Button on:click={removeTOTPSecret} disabled={saving}>
624
+ <Label>Remove 2FA</Label>
625
+ </Button>
626
+ {/if}
627
+ </div>
628
+ </LayoutCell>
597
629
  </LayoutGrid>
598
630
  {/if}
599
631
 
@@ -713,6 +745,7 @@
713
745
  let secondaryGroupSearch = '';
714
746
  let ability = '';
715
747
  let avatar = 'https://secure.gravatar.com/avatar/?d=mm&s=40';
748
+ let hasTOTPSecret: boolean | undefined = undefined;
716
749
  let failureMessage: string | undefined = undefined;
717
750
  let passwordVerify = '';
718
751
  let passwordVerified: boolean | undefined = undefined;
@@ -734,6 +767,7 @@
734
767
  user = (await User.current()) ?? undefined;
735
768
  sysAdmin = (await user?.$gatekeeper('system/admin')) ?? false;
736
769
  tilmeldSwitchUser = (await user?.$gatekeeper('tilmeld/switch')) ?? false;
770
+ hasTOTPSecret = (await user?.$hasTOTPSecret()) ?? false;
737
771
  });
738
772
  onMount(async () => {
739
773
  clientConfig = await User.getClientConfig();
@@ -988,6 +1022,25 @@
988
1022
  }
989
1023
  }
990
1024
 
1025
+ async function removeTOTPSecret() {
1026
+ failureMessage = undefined;
1027
+ if (confirm("Are you sure you want to remove the user's 2FA?")) {
1028
+ saving = true;
1029
+ try {
1030
+ const result = await entity.$removeTOTPSecret();
1031
+
1032
+ if (result.result) {
1033
+ hasTOTPSecret = false;
1034
+ } else {
1035
+ failureMessage = result.message;
1036
+ }
1037
+ } catch (e: any) {
1038
+ failureMessage = e?.message;
1039
+ }
1040
+ saving = false;
1041
+ }
1042
+ }
1043
+
991
1044
  async function saveEntity() {
992
1045
  if (
993
1046
  (entity.passwordTemp != null || entity.passwordTemp !== '') &&