@live-change/user-frontend 0.9.110 → 0.9.112

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.
@@ -5,7 +5,9 @@
5
5
  "codeNotFound": "Secret code not recognized.",
6
6
  "codeExpired": "Secret code expired.",
7
7
  "wrongPassword": "Wrong password.",
8
- "emailNotFound": "Email not found."
8
+ "emailNotFound": "Email not found.",
9
+ "unsafePassword": "Password is unsafe, try to use a stronger one.",
10
+ "passwordNotMatch": "Passwords do not match."
9
11
  },
10
12
  "app": {
11
13
  "updateAvailable": "Update available!",
@@ -1,23 +1,30 @@
1
1
  <template>
2
2
  <div class="w-full lg:w-6/12 md:w-9/12 max-w-[32rem]" v-shared-element:form="{ duration: '300ms', includeChildren: true }">
3
3
 
4
- <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isUnknown">
4
+ <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isUnknown && !isRedirecting">
5
5
  <div class="text-surface-900 dark:text-surface-0 font-medium mb-4 text-xl">Unknown link</div>
6
- <p class="mt-0 mb-2 p-0 leading-normal">We can't find your secret link. Check if you copied the address correctly.</p>
6
+ <p class="mt-0 mb-2 p-0 leading-normal">
7
+ We can't find your secret link. Check if you copied the address correctly.
8
+ </p>
7
9
  </div>
8
10
 
9
- <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isUsed">
11
+ <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isUsed && !isRedirecting">
10
12
  <div class="text-surface-900 dark:text-surface-0 font-medium mb-4 text-xl">Link used</div>
11
- <p class="mt-0 mb-2 p-0 leading-normal">This link was already used.</p>
13
+ <p class="mt-0 mb-2 p-0 leading-normal">
14
+ This link was already used.
15
+ </p>
12
16
  </div>
13
17
 
14
- <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isExpired && !isUsed">
18
+ <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6" v-if="isExpired && !isUsed && !isRedirecting">
15
19
  <div class="text-surface-900 dark:text-surface-0 font-medium mb-4 text-xl">Link expired</div>
16
- <p class="mt-0 mb-6 p-0 leading-normal">Your secret link already expired. To send another link click button below.</p>
20
+ <p class="mt-0 mb-6 p-0 leading-normal">
21
+ Your secret link already expired. To send another link click button below.
22
+ </p>
17
23
  <Button label="Resend" class="p-button-lg" @click="resend"></Button>
18
24
  </div>
19
25
 
20
- <div class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6 flex justify-center" v-if="isReady">
26
+ <div v-if="isReady || isRedirecting"
27
+ class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6 flex justify-center">
21
28
  <ProgressSpinner class="m-4" />
22
29
  </div>
23
30
  </div>
@@ -27,7 +34,7 @@
27
34
  import Button from "primevue/button"
28
35
  import ProgressSpinner from "primevue/progressspinner"
29
36
 
30
- import { computed, inject } from 'vue'
37
+ import { computed, inject, ref } from 'vue'
31
38
  import { useRouter } from 'vue-router'
32
39
  import { useNow } from '@vueuse/core'
33
40
  import { path, live, actions } from '@live-change/vue3-ssr'
@@ -75,23 +82,30 @@
75
82
  const isUnknown = computed(() => link.value === null)
76
83
  const isExpired = computed(() => link.value ? (now.value.toISOString() > link.value.expire) : false )
77
84
  const isUsed = computed(() => authenticationState.value && authenticationState.value === 'used')
78
- const isReady = computed(() => !(isUnknown.value || isExpired.value || isUsed.value))
85
+ const isReady = computed(() => !(isUnknown.value || isExpired.value || isUsed.value))
79
86
 
80
87
  //const targetPage = computed(() => link.value?.authenticationData?.targetPage )
81
88
 
89
+ const isRedirecting = ref(false)
90
+
82
91
  if(typeof window != 'undefined') setTimeout(() => { /// timeout "fixes" suspense bug
92
+ console.log("LINK", link.value)
83
93
  if(isReady.value) {
84
94
  workingZone.addPromise('finishMessageAuthentication', (async () => {
85
95
  const { result, targetPage } = await finishMessageAuthentication({ secretType: 'link', secret: secretCode })
86
96
  router.push(targetPage)
87
97
  })())
98
+ isRedirecting.value = true
99
+ return
88
100
  }
89
101
  if(isUsed.value || isExpired.value) {
102
+ console.log("LINK USED IS USED!", link)
90
103
  const fallbackPage = link.value?.authenticationData?.fallbackPage
91
104
  console.log("FB", fallbackPage)
92
105
  if(fallbackPage) {
93
106
  const error = isUsed.value ? 'used' : 'expired'
94
107
  router.push({ ...fallbackPage, params: { ...fallbackPage.params, error } })
108
+ isRedirecting.value = true
95
109
  }
96
110
  }
97
111
  }, 10)
@@ -15,14 +15,15 @@
15
15
  <p class="mt-0 mb-6 p-0 leading-normal">Your password reset authentication already expired.</p>
16
16
  </div>
17
17
 
18
- <div class="bg-surface-0 dark:bg-surface-900 p-6 shadow rounded-border" v-if="isReady">
18
+ <div class="bg-surface-0 dark:bg-surface-900 p-6 shadow rounded-border" v-if="isReady || working">
19
19
  <div class="text-center mb-8">
20
20
  <div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">Reset password</div>
21
21
  </div>
22
22
 
23
23
  <command-form service="passwordAuthentication" action="finishResetPassword" v-slot="{ data }"
24
24
  :parameters="{ key: resetKey }" ref="form"
25
- @done="handleDone" keepOnDone>
25
+ @done="handleDone" keepOnDone
26
+ @submit="handleSubmit" @error="handleError">
26
27
 
27
28
  <template v-if="isMounted">
28
29
  <div class="p-field mb-4">
@@ -59,6 +60,10 @@
59
60
 
60
61
  </command-form>
61
62
  </div>
63
+ <div v-if="redirecting"
64
+ class="bg-surface-0 dark:bg-surface-900 rounded-border shadow p-6 flex justify-center">
65
+ <ProgressSpinner class="m-4" />
66
+ </div>
62
67
  </div>
63
68
  </template>
64
69
 
@@ -77,6 +82,9 @@
77
82
  }
78
83
  })
79
84
 
85
+ import { useI18n } from 'vue-i18n'
86
+ const { t } = useI18n()
87
+
80
88
  import { useNow } from '@vueuse/core'
81
89
  const now = useNow({ interval: 1000 })
82
90
 
@@ -102,14 +110,27 @@
102
110
  live( path().passwordAuthentication.resetPasswordAuthenticationByKey({ key: resetKey }) )
103
111
  ])
104
112
 
113
+ const working = ref(false)
114
+ const redirecting = ref(false)
115
+
105
116
  const isUnknown = computed(() => authentication.value === null)
106
117
  const isExpired = computed(() =>
107
118
  authentication.value ? (now.value.toISOString() > authentication.value.expire) : false )
108
- const isUsed = computed(() => authentication.value && authentication.value.state === 'used')
109
- const isReady = computed(() => !(isUnknown.value || isExpired.value || isUsed.value))
119
+ const isUsed = computed(() => !working.value && !redirecting.value && authentication.value && authentication.value.state === 'used')
120
+ const isReady = computed(() => !(isUnknown.value || isExpired.value || isUsed.value))
121
+
122
+ function handleSubmit() {
123
+ working.value = true
124
+ }
125
+
126
+ function handleError() {
127
+ working.value = false
128
+ }
110
129
 
111
130
  function handleDone({ parameters, result }) {
112
131
  console.log("DONE RESULT", result)
132
+ redirecting.value = true
133
+ working.value = false
113
134
  router.push({
114
135
  name: 'user:resetPasswordFinished'
115
136
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.9.110",
3
+ "version": "0.9.112",
4
4
  "scripts": {
5
5
  "memDev": "node --inspect --expose-gc server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
@@ -22,29 +22,29 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/cli": "^0.9.110",
26
- "@live-change/dao": "^0.9.110",
27
- "@live-change/dao-vue3": "^0.9.110",
28
- "@live-change/dao-websocket": "^0.9.110",
29
- "@live-change/email-service": "^0.9.110",
30
- "@live-change/framework": "^0.9.110",
31
- "@live-change/identicon-service": "^0.9.110",
32
- "@live-change/image-frontend": "^0.9.110",
33
- "@live-change/message-authentication-service": "^0.9.110",
34
- "@live-change/notification-service": "^0.9.110",
35
- "@live-change/password-authentication-service": "^0.9.110",
36
- "@live-change/pattern": "^0.9.110",
37
- "@live-change/secret-code-service": "^0.9.110",
38
- "@live-change/secret-link-service": "^0.9.110",
39
- "@live-change/security-frontend": "^0.9.110",
40
- "@live-change/security-service": "^0.9.110",
41
- "@live-change/session-service": "^0.9.110",
42
- "@live-change/timer-service": "^0.9.110",
43
- "@live-change/upload-service": "^0.9.110",
44
- "@live-change/user-identification-service": "^0.9.110",
45
- "@live-change/user-service": "^0.9.110",
46
- "@live-change/vue3-components": "^0.9.110",
47
- "@live-change/vue3-ssr": "^0.9.110",
25
+ "@live-change/cli": "^0.9.112",
26
+ "@live-change/dao": "^0.9.112",
27
+ "@live-change/dao-vue3": "^0.9.112",
28
+ "@live-change/dao-websocket": "^0.9.112",
29
+ "@live-change/email-service": "^0.9.112",
30
+ "@live-change/framework": "^0.9.112",
31
+ "@live-change/identicon-service": "^0.9.112",
32
+ "@live-change/image-frontend": "^0.9.112",
33
+ "@live-change/message-authentication-service": "^0.9.112",
34
+ "@live-change/notification-service": "^0.9.112",
35
+ "@live-change/password-authentication-service": "^0.9.112",
36
+ "@live-change/pattern": "^0.9.112",
37
+ "@live-change/secret-code-service": "^0.9.112",
38
+ "@live-change/secret-link-service": "^0.9.112",
39
+ "@live-change/security-frontend": "^0.9.112",
40
+ "@live-change/security-service": "^0.9.112",
41
+ "@live-change/session-service": "^0.9.112",
42
+ "@live-change/timer-service": "^0.9.112",
43
+ "@live-change/upload-service": "^0.9.112",
44
+ "@live-change/user-identification-service": "^0.9.112",
45
+ "@live-change/user-service": "^0.9.112",
46
+ "@live-change/vue3-components": "^0.9.112",
47
+ "@live-change/vue3-ssr": "^0.9.112",
48
48
  "@vueuse/core": "^12.3.0",
49
49
  "codeceptjs-assert": "^0.0.5",
50
50
  "codeceptjs-video-helper": "0.1.3",
@@ -65,7 +65,7 @@
65
65
  "wtfnode": "^0.9.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@live-change/codeceptjs-helper": "^0.9.110",
68
+ "@live-change/codeceptjs-helper": "^0.9.112",
69
69
  "codeceptjs": "^3.6.10",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "1.49.1",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "856dd2e63a9c18efd85943caf04d898847c09805"
79
+ "gitHead": "168448832a1c3b4fb17602293e3ed48425b697a9"
80
80
  }