@live-change/user-frontend 0.8.130 → 0.8.132

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.
@@ -64,7 +64,7 @@ export function installUserRedirects(router, app, config) {
64
64
  if(to?.matched.find(m => m?.meta.signedIn)) {
65
65
  if(!client.value.user) {
66
66
  console.log("REDIRECT TO LOGIN BECAUSE PAGE REQUIRES LOGIN!")
67
- router.redirectAfterSignIn = to.fullPath
67
+ router.redirectAfterSignIn = JSON.stringify(to.fullPath)
68
68
  return { name: 'user:signInEmail' }
69
69
  }
70
70
  }
@@ -76,7 +76,7 @@ export function installUserRedirects(router, app, config) {
76
76
  }
77
77
  if(to && to.name === 'user:signInEmail' && from?.matched.find(m => m?.meta.saveForSignIn)) {
78
78
  console.log("SAVE FOR LOGIN", from.fullPath)
79
- localStorage.redirectAfterLogin = from.fullPath
79
+ router.redirectAfterSignIn = JSON.stringify(to.fullPath)
80
80
  }
81
81
  })
82
82
  }
@@ -3,8 +3,8 @@
3
3
  <div class="surface-card border-round shadow-2 p-4">
4
4
  <div class="text-900 font-medium mb-3 text-xl mb-4">Signed In</div>
5
5
  <p class="mt-0 p-0 line-height-3">Congratulations! You have successfully logged in to your account.</p>
6
- <div v-if="afterSignIn" class="flex flex-row align-items-center">
7
- <router-link :to="afterSignIn" class="no-underline">
6
+ <div v-if="afterSignIn" class="flex flex-row justify-content-center align-items-center">
7
+ <router-link :to="JSON.parse(afterSignIn)" class="no-underline">
8
8
  <Button label="Next" v-ripple />
9
9
  </router-link>
10
10
  <p class="ml-4" v-if="isMounted && redirectTime">
@@ -35,15 +35,15 @@
35
35
  import pluralize from 'pluralize'
36
36
 
37
37
  const afterSignIn = computed( () => isMounted.value && localStorage.redirectAfterSignIn )
38
- let redirectTime
38
+ const redirectTime = ref()
39
39
  onMounted(() => {
40
- redirectTime = new Date(Date.now() + 10 * 1000)
40
+ redirectTime.value = new Date(Date.now() + 10 * 1000)
41
41
  setTimeout(() => {
42
42
  if (afterSignIn.value) {
43
43
  localStorage.removeItem('redirectAfterSignIn')
44
- router.push(afterSignIn.value)
44
+ router.push(JSON.parse(afterSignIn.value))
45
45
  }
46
- }, 10 * 1000)
46
+ }, redirectTime.value - currentTime.value)
47
47
  })
48
48
  </script>
49
49
 
@@ -8,9 +8,17 @@
8
8
  </div>
9
9
  <p class="mt-0 p-0 line-height-3">
10
10
  Congratulations! You have successfully created your account.
11
- <span v-if="needPassword">
11
+ <span v-if="needPassword && !afterSignIn">
12
12
  You can now set password to secure your account.
13
13
  </span>
14
+ <div v-else-if="afterSignIn" class="flex flex-row justify-content-center align-items-center">
15
+ <router-link :to="JSON.parse(afterSignIn)" class="no-underline">
16
+ <Button label="Next" v-ripple />
17
+ </router-link>
18
+ <p class="ml-4" v-if="isMounted && redirectTime">
19
+ Redirect in {{ pluralize('second', Math.ceil((redirectTime - currentTime) / 1000), true) }}...
20
+ </p>
21
+ </div>
14
22
  <p v-else>
15
23
 
16
24
  Setup your <router-link :to="{ name: 'user:identification' }">profile</router-link>
@@ -19,7 +27,7 @@
19
27
  </p>
20
28
  </div>
21
29
 
22
- <div class="surface-card p-4 shadow-2 border-round mt-2" v-if="needPassword">
30
+ <div class="surface-card p-4 shadow-2 border-round mt-2" v-if="needPassword && !afterSignIn">
23
31
  <div class="text-center mb-5">
24
32
  <div class="text-900 text-3xl font-medium mb-3">
25
33
  {{ passwordExists ? 'Change password' : 'Set password' }}
@@ -82,6 +90,10 @@
82
90
  import { live, path } from '@live-change/vue3-ssr'
83
91
  import { computed, ref, onMounted } from 'vue'
84
92
 
93
+ import { currentTime } from "@live-change/frontend-base"
94
+
95
+ import pluralize from 'pluralize'
96
+
85
97
  import { useRouter } from 'vue-router'
86
98
  const router = useRouter()
87
99
 
@@ -99,6 +111,18 @@
99
111
  live(path().phone?.myUserPhones())
100
112
  ])
101
113
 
114
+ const afterSignIn = computed( () => isMounted.value && localStorage.redirectAfterSignIn )
115
+ const redirectTime = ref()
116
+ onMounted(() => {
117
+ redirectTime.value = new Date(Date.now() + 10 * 1000)
118
+ setTimeout(() => {
119
+ if (afterSignIn.value) {
120
+ localStorage.removeItem('redirectAfterSignIn')
121
+ router.push(JSON.parse(afterSignIn.value))
122
+ }
123
+ }, redirectTime.value - currentTime.value)
124
+ })
125
+
102
126
  const needPassword = computed(() => (!passwordExists.value
103
127
  && (emails.value?.length > 0 || phones.value?.length > 0)
104
128
  ))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.8.130",
3
+ "version": "0.8.132",
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.8.130",
26
- "@live-change/dao": "^0.8.130",
27
- "@live-change/dao-vue3": "^0.8.130",
28
- "@live-change/dao-websocket": "^0.8.130",
29
- "@live-change/email-service": "^0.8.130",
30
- "@live-change/framework": "^0.8.130",
31
- "@live-change/identicon-service": "^0.8.130",
32
- "@live-change/image-frontend": "^0.8.130",
33
- "@live-change/message-authentication-service": "^0.8.130",
34
- "@live-change/notification-service": "^0.8.130",
35
- "@live-change/password-authentication-service": "^0.8.130",
36
- "@live-change/pattern": "^0.8.130",
37
- "@live-change/secret-code-service": "^0.8.130",
38
- "@live-change/secret-link-service": "^0.8.130",
39
- "@live-change/security-frontend": "^0.8.130",
40
- "@live-change/security-service": "^0.8.130",
41
- "@live-change/session-service": "^0.8.130",
42
- "@live-change/timer-service": "^0.8.130",
43
- "@live-change/upload-service": "^0.8.130",
44
- "@live-change/user-identification-service": "^0.8.130",
45
- "@live-change/user-service": "^0.8.130",
46
- "@live-change/vue3-components": "^0.8.130",
47
- "@live-change/vue3-ssr": "^0.8.130",
25
+ "@live-change/cli": "^0.8.132",
26
+ "@live-change/dao": "^0.8.132",
27
+ "@live-change/dao-vue3": "^0.8.132",
28
+ "@live-change/dao-websocket": "^0.8.132",
29
+ "@live-change/email-service": "^0.8.132",
30
+ "@live-change/framework": "^0.8.132",
31
+ "@live-change/identicon-service": "^0.8.132",
32
+ "@live-change/image-frontend": "^0.8.132",
33
+ "@live-change/message-authentication-service": "^0.8.132",
34
+ "@live-change/notification-service": "^0.8.132",
35
+ "@live-change/password-authentication-service": "^0.8.132",
36
+ "@live-change/pattern": "^0.8.132",
37
+ "@live-change/secret-code-service": "^0.8.132",
38
+ "@live-change/secret-link-service": "^0.8.132",
39
+ "@live-change/security-frontend": "^0.8.132",
40
+ "@live-change/security-service": "^0.8.132",
41
+ "@live-change/session-service": "^0.8.132",
42
+ "@live-change/timer-service": "^0.8.132",
43
+ "@live-change/upload-service": "^0.8.132",
44
+ "@live-change/user-identification-service": "^0.8.132",
45
+ "@live-change/user-service": "^0.8.132",
46
+ "@live-change/vue3-components": "^0.8.132",
47
+ "@live-change/vue3-ssr": "^0.8.132",
48
48
  "@vueuse/core": "^10.11.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.8.130",
68
+ "@live-change/codeceptjs-helper": "^0.8.132",
69
69
  "codeceptjs": "^3.6.5",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "^1.41.2",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "9fbe1673e887249a034819694bb283f948488731"
79
+ "gitHead": "2a89523fb97da895d65247edfecdc325fb37095e"
80
80
  }