una-nuxt-module 3.0.15 → 3.0.16
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -21,10 +21,11 @@ export default defineNuxtRouteMiddleware(async () => {
|
|
|
21
21
|
const authResponse = await $authData();
|
|
22
22
|
const token = await $accessToken();
|
|
23
23
|
const resources = await authorization.getResources(token);
|
|
24
|
+
let email = "";
|
|
24
25
|
const getUserInfo = () => {
|
|
25
26
|
if (authResponse?.email) {
|
|
26
27
|
const rawEmail = Array.isArray(authResponse?.email) ? authResponse?.email[0] : authResponse?.email;
|
|
27
|
-
|
|
28
|
+
email = rawEmail?.trim();
|
|
28
29
|
const [name, lastName] = email.toUpperCase().split(".");
|
|
29
30
|
return {
|
|
30
31
|
name,
|
|
@@ -34,8 +35,8 @@ export default defineNuxtRouteMiddleware(async () => {
|
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
37
|
const userInfo = {
|
|
38
|
+
email,
|
|
37
39
|
cedula: authResponse?.displayName,
|
|
38
|
-
email: authResponse?.email,
|
|
39
40
|
...getUserInfo()
|
|
40
41
|
};
|
|
41
42
|
const authData = {
|
|
@@ -27,10 +27,11 @@ export default defineNuxtPlugin(() => {
|
|
|
27
27
|
const { $pinia } = useNuxtApp();
|
|
28
28
|
const authStore = useAuthStore($pinia);
|
|
29
29
|
const authorization = useAuthorization();
|
|
30
|
+
let email = "";
|
|
30
31
|
const getUserInfo = () => {
|
|
31
32
|
if (response?.email) {
|
|
32
33
|
const rawEmail = Array.isArray(response?.email) ? response?.email[0] : response?.email;
|
|
33
|
-
|
|
34
|
+
email = rawEmail?.trim();
|
|
34
35
|
const [name, lastName] = email.toUpperCase().split(".");
|
|
35
36
|
return {
|
|
36
37
|
name,
|
|
@@ -40,8 +41,8 @@ export default defineNuxtPlugin(() => {
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
const userInfo = {
|
|
44
|
+
email,
|
|
43
45
|
cedula: response.displayName,
|
|
44
|
-
email: response.email,
|
|
45
46
|
...getUserInfo()
|
|
46
47
|
};
|
|
47
48
|
const token = await auth?.getAccessToken();
|