@adminforth/email-invite 1.0.8 → 1.0.10
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/build.log +2 -2
- package/custom/SetPassword.vue +29 -2
- package/custom/tsconfig.json +14 -3
- package/dist/custom/SetPassword.vue +29 -2
- package/dist/custom/tsconfig.json +14 -3
- package/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
package/build.log
CHANGED
package/custom/SetPassword.vue
CHANGED
|
@@ -37,8 +37,16 @@
|
|
|
37
37
|
<!-- Modal body -->
|
|
38
38
|
<div class="p-4 md:p-5">
|
|
39
39
|
<!-- Success message -->
|
|
40
|
-
<div v-if="passwordSet" class="af-alert-success flex items-center justify-center
|
|
41
|
-
<div class="text-center">
|
|
40
|
+
<div v-if="passwordSet" class="af-alert-success flex items-center justify-center pt-4 text-sm rounded-lg dark:text-white" role="alert">
|
|
41
|
+
<div v-if="isUserLoggedIn === 'true'" class="text-center w-full">
|
|
42
|
+
<p class="text-start" >{{$t('Password set successfully to your new account')}}</p>
|
|
43
|
+
<p class="text-start font-bold pb-4">{{$t('Stay logged in or log in to another account?')}}</p>
|
|
44
|
+
<div class="flex gap-4 w-full justify-between mt-4">
|
|
45
|
+
<Button class="flex-1" @click="stayLoggedIn">{{ $t('Stay logged in') }}</Button>
|
|
46
|
+
<Button class="flex-1" @click="logoutUser">{{ $t('Log out ') }}</Button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div v-else class="text-center">
|
|
42
50
|
<p class="mb-3">{{$t('Password set successfully!')}}</p>
|
|
43
51
|
<Link to="/login" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
44
52
|
{{$t('Go to Login')}}
|
|
@@ -146,6 +154,7 @@
|
|
|
146
154
|
<script setup lang="ts">
|
|
147
155
|
import { onMounted, ref, computed, Ref } from 'vue';
|
|
148
156
|
import { useCoreStore } from '@/stores/core';
|
|
157
|
+
import { useUserStore } from '@/stores/user';
|
|
149
158
|
import { callAdminForthApi, loadFile, applyRegexValidation } from '@/utils';
|
|
150
159
|
import { useRoute, useRouter } from 'vue-router';
|
|
151
160
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
@@ -157,6 +166,7 @@ const loading = ref(true);
|
|
|
157
166
|
const tokenValid = ref(false);
|
|
158
167
|
const passwordSet = ref(false);
|
|
159
168
|
|
|
169
|
+
const userStore = useUserStore();
|
|
160
170
|
const coreStore = useCoreStore();
|
|
161
171
|
|
|
162
172
|
const passwordConfirmationInput = ref(null);
|
|
@@ -170,6 +180,8 @@ const router = useRouter();
|
|
|
170
180
|
const validationRunning = ref(false);
|
|
171
181
|
const error = ref(null);
|
|
172
182
|
|
|
183
|
+
const isUserLoggedIn = localStorage.getItem('isAuthorized');
|
|
184
|
+
|
|
173
185
|
const backgroundPosition = computed(() => {
|
|
174
186
|
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
175
187
|
});
|
|
@@ -259,4 +271,19 @@ async function setPassword() {
|
|
|
259
271
|
passwordSet.value = true;
|
|
260
272
|
}
|
|
261
273
|
}
|
|
274
|
+
|
|
275
|
+
async function logoutUser() {
|
|
276
|
+
userStore.unauthorize();
|
|
277
|
+
await userStore.logout();
|
|
278
|
+
router.push({ name: 'login' })
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function stayLoggedIn() {
|
|
282
|
+
coreStore.fetchMenuAndResource();
|
|
283
|
+
if (route.query.next) {
|
|
284
|
+
router.push(route.query.next.toString());
|
|
285
|
+
} else {
|
|
286
|
+
router.push({ name: 'home' });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
262
289
|
</script>
|
package/custom/tsconfig.json
CHANGED
|
@@ -4,16 +4,27 @@
|
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
6
|
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
-
"../../../spa/src/*"
|
|
7
|
+
"../../../adminforth/spa/src/*"
|
|
8
8
|
],
|
|
9
9
|
"*": [
|
|
10
10
|
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
-
"../../../spa/node_modules/*"
|
|
11
|
+
"../../../adminforth/spa/node_modules/*"
|
|
12
12
|
],
|
|
13
13
|
"@@/*": [
|
|
14
14
|
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
15
|
"."
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"./**/*.ts",
|
|
21
|
+
"./**/*.tsx",
|
|
22
|
+
"./**/*.vue",
|
|
23
|
+
"../**/*.ts",
|
|
24
|
+
"../**/*.tsx",
|
|
25
|
+
"../**/*.vue",
|
|
26
|
+
"../*.vue",
|
|
27
|
+
"../*.ts",
|
|
28
|
+
"../*.tsx"
|
|
29
|
+
]
|
|
19
30
|
}
|
|
@@ -37,8 +37,16 @@
|
|
|
37
37
|
<!-- Modal body -->
|
|
38
38
|
<div class="p-4 md:p-5">
|
|
39
39
|
<!-- Success message -->
|
|
40
|
-
<div v-if="passwordSet" class="af-alert-success flex items-center justify-center
|
|
41
|
-
<div class="text-center">
|
|
40
|
+
<div v-if="passwordSet" class="af-alert-success flex items-center justify-center pt-4 text-sm rounded-lg dark:text-white" role="alert">
|
|
41
|
+
<div v-if="isUserLoggedIn === 'true'" class="text-center w-full">
|
|
42
|
+
<p class="text-start" >{{$t('Password set successfully to your new account')}}</p>
|
|
43
|
+
<p class="text-start font-bold pb-4">{{$t('Stay logged in or log in to another account?')}}</p>
|
|
44
|
+
<div class="flex gap-4 w-full justify-between mt-4">
|
|
45
|
+
<Button class="flex-1" @click="stayLoggedIn">{{ $t('Stay logged in') }}</Button>
|
|
46
|
+
<Button class="flex-1" @click="logoutUser">{{ $t('Log out ') }}</Button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div v-else class="text-center">
|
|
42
50
|
<p class="mb-3">{{$t('Password set successfully!')}}</p>
|
|
43
51
|
<Link to="/login" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
44
52
|
{{$t('Go to Login')}}
|
|
@@ -146,6 +154,7 @@
|
|
|
146
154
|
<script setup lang="ts">
|
|
147
155
|
import { onMounted, ref, computed, Ref } from 'vue';
|
|
148
156
|
import { useCoreStore } from '@/stores/core';
|
|
157
|
+
import { useUserStore } from '@/stores/user';
|
|
149
158
|
import { callAdminForthApi, loadFile, applyRegexValidation } from '@/utils';
|
|
150
159
|
import { useRoute, useRouter } from 'vue-router';
|
|
151
160
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
@@ -157,6 +166,7 @@ const loading = ref(true);
|
|
|
157
166
|
const tokenValid = ref(false);
|
|
158
167
|
const passwordSet = ref(false);
|
|
159
168
|
|
|
169
|
+
const userStore = useUserStore();
|
|
160
170
|
const coreStore = useCoreStore();
|
|
161
171
|
|
|
162
172
|
const passwordConfirmationInput = ref(null);
|
|
@@ -170,6 +180,8 @@ const router = useRouter();
|
|
|
170
180
|
const validationRunning = ref(false);
|
|
171
181
|
const error = ref(null);
|
|
172
182
|
|
|
183
|
+
const isUserLoggedIn = localStorage.getItem('isAuthorized');
|
|
184
|
+
|
|
173
185
|
const backgroundPosition = computed(() => {
|
|
174
186
|
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
175
187
|
});
|
|
@@ -259,4 +271,19 @@ async function setPassword() {
|
|
|
259
271
|
passwordSet.value = true;
|
|
260
272
|
}
|
|
261
273
|
}
|
|
274
|
+
|
|
275
|
+
async function logoutUser() {
|
|
276
|
+
userStore.unauthorize();
|
|
277
|
+
await userStore.logout();
|
|
278
|
+
router.push({ name: 'login' })
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function stayLoggedIn() {
|
|
282
|
+
coreStore.fetchMenuAndResource();
|
|
283
|
+
if (route.query.next) {
|
|
284
|
+
router.push(route.query.next.toString());
|
|
285
|
+
} else {
|
|
286
|
+
router.push({ name: 'home' });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
262
289
|
</script>
|
|
@@ -4,16 +4,27 @@
|
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
6
|
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
-
"../../../spa/src/*"
|
|
7
|
+
"../../../adminforth/spa/src/*"
|
|
8
8
|
],
|
|
9
9
|
"*": [
|
|
10
10
|
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
-
"../../../spa/node_modules/*"
|
|
11
|
+
"../../../adminforth/spa/node_modules/*"
|
|
12
12
|
],
|
|
13
13
|
"@@/*": [
|
|
14
14
|
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
15
|
"."
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"./**/*.ts",
|
|
21
|
+
"./**/*.tsx",
|
|
22
|
+
"./**/*.vue",
|
|
23
|
+
"../**/*.ts",
|
|
24
|
+
"../**/*.tsx",
|
|
25
|
+
"../**/*.vue",
|
|
26
|
+
"../*.vue",
|
|
27
|
+
"../*.ts",
|
|
28
|
+
"../*.tsx"
|
|
29
|
+
]
|
|
19
30
|
}
|
package/dist/index.js
CHANGED
|
@@ -203,7 +203,7 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
|
|
|
203
203
|
const { email, recordId } = decoded;
|
|
204
204
|
let userRecord;
|
|
205
205
|
if (recordId) {
|
|
206
|
-
userRecord = yield this.adminforth.resource(this.authResource.resourceId).get(recordId);
|
|
206
|
+
userRecord = yield this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.authResource.columns.find(c => c.primaryKey).name, recordId));
|
|
207
207
|
}
|
|
208
208
|
if (!userRecord && email) {
|
|
209
209
|
const records = yield this.adminforth.resource(this.authResource.resourceId).list(Filters.EQ(this.options.emailField, email), 1);
|
package/index.ts
CHANGED
|
@@ -249,7 +249,7 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
|
|
|
249
249
|
let userRecord;
|
|
250
250
|
|
|
251
251
|
if (recordId) {
|
|
252
|
-
userRecord = await this.adminforth.resource(this.authResource.resourceId).get(recordId);
|
|
252
|
+
userRecord = await this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.authResource.columns.find(c => c.primaryKey).name, recordId));
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
if (!userRecord && email) {
|