@sowell/quasar-app-extension-auth 0.2.3 → 0.2.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sowell/quasar-app-extension-auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "A Quasar app extension to manage Authentication",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/sowell-ai/quasar.extension.auth",
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"lint": "cd dev && eslint --ext .js,.ts,.vue ./",
|
|
9
9
|
"dev": "cd dev && quasar dev",
|
|
10
10
|
"dep": "cd dev && yarn",
|
|
11
|
-
"test:
|
|
12
|
-
"test:
|
|
11
|
+
"test:link": "cd dev && yarn test:link",
|
|
12
|
+
"test:browser": "cd dev && yarn test:browser",
|
|
13
|
+
"test": "cd dev && yarn test"
|
|
13
14
|
},
|
|
14
15
|
"keywords": [],
|
|
15
16
|
"author": "SoWell SAS",
|
|
@@ -5,17 +5,17 @@ import { BootInterface } from "../interfaces";
|
|
|
5
5
|
|
|
6
6
|
export default boot(({ router, store }: BootInterface) => {
|
|
7
7
|
const {
|
|
8
|
-
"@sowell/auth": { LOCAL_LOGIN_ROUTE
|
|
8
|
+
"@sowell/auth": { LOCAL_LOGIN_ROUTE },
|
|
9
9
|
} = prompts;
|
|
10
10
|
|
|
11
11
|
router.beforeEach((to, from, next) => {
|
|
12
|
-
let isValid = store.getters["token/getIsValid"]
|
|
13
|
-
let token = store.getters["token/getRaw"]
|
|
12
|
+
let isValid = store.getters["token/getIsValid"];
|
|
13
|
+
let token = store.getters["token/getRaw"];
|
|
14
14
|
if (
|
|
15
15
|
!isValid &&
|
|
16
16
|
!token &&
|
|
17
17
|
to.path !== LOCAL_LOGIN_ROUTE &&
|
|
18
|
-
to.
|
|
18
|
+
to.name !== "update_password"
|
|
19
19
|
) {
|
|
20
20
|
next(LOCAL_LOGIN_ROUTE);
|
|
21
21
|
} else {
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-
|
|
3
|
-
<q-
|
|
4
|
-
<
|
|
5
|
-
<div class="
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
v-model="password"
|
|
15
|
-
type="password"
|
|
16
|
-
:label="$t('auth.newPassword')"
|
|
17
|
-
:rules="validations['passwordRules']"
|
|
18
|
-
rounded
|
|
19
|
-
outlined
|
|
20
|
-
dense
|
|
21
|
-
class="full-width q-mb-md"
|
|
22
|
-
>
|
|
23
|
-
</q-input>
|
|
24
|
-
<q-input
|
|
25
|
-
id="passwordConfirmation"
|
|
26
|
-
v-model="passwordConfirmation"
|
|
27
|
-
type="password"
|
|
28
|
-
:label="$t('auth.newPasswordConfirmation')"
|
|
29
|
-
:rules="validations['passwordConfirmationRules']"
|
|
30
|
-
rounded
|
|
31
|
-
outlined
|
|
32
|
-
dense
|
|
33
|
-
class="full-width q-mb-md"
|
|
2
|
+
<q-layout>
|
|
3
|
+
<q-page class="flex flex-center">
|
|
4
|
+
<div>
|
|
5
|
+
<div class="column items-center q-mb-xl">
|
|
6
|
+
<img
|
|
7
|
+
style="width: 40px"
|
|
8
|
+
src="../../assets/Logo.svg"
|
|
9
|
+
class="q-mb-sm"
|
|
10
|
+
/>
|
|
11
|
+
<div
|
|
12
|
+
class="text-h5 text-center head q-mt-sm"
|
|
13
|
+
style="font-size: 17px; font-weight: 500"
|
|
34
14
|
>
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
{{ $t("auth.passwordRecovery") }}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<q-form class="column items-center" @submit="onSubmit">
|
|
19
|
+
<div>
|
|
20
|
+
<div class="q-mb-sm" style="font-size: 14px; font-weight: 400">
|
|
21
|
+
{{ $t("auth.newPassword") }}
|
|
22
|
+
</div>
|
|
23
|
+
<q-input
|
|
24
|
+
id="password"
|
|
25
|
+
v-model="password"
|
|
26
|
+
data-cy="reset-password"
|
|
27
|
+
:rules="validations['passwordRules']"
|
|
28
|
+
outlined
|
|
29
|
+
dense
|
|
30
|
+
class="full-width q-mb-md"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
<div class="full-width">
|
|
35
|
+
<q-btn
|
|
36
|
+
rounded
|
|
37
|
+
:label="$t('common.register')"
|
|
38
|
+
color="primary"
|
|
39
|
+
:loading="loading"
|
|
40
|
+
type="submit"
|
|
41
|
+
no-caps
|
|
42
|
+
data-cy="send-new-password"
|
|
43
|
+
class="full-width"
|
|
44
|
+
:disable="canSubmit"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</q-form>
|
|
48
|
+
</div>
|
|
49
|
+
</q-page>
|
|
50
|
+
</q-layout>
|
|
52
51
|
</template>
|
|
53
52
|
|
|
54
53
|
<script lang="ts">
|
|
55
|
-
|
|
54
|
+
//@ts-ignore
|
|
56
55
|
import { computed, defineComponent, ref } from "vue";
|
|
56
|
+
import { useQuasar } from "quasar";
|
|
57
57
|
import { useI18n } from "vue-i18n";
|
|
58
58
|
import { useRouter } from "vue-router";
|
|
59
59
|
import { $api, $prompts } from "../../injects";
|
|
@@ -70,31 +70,21 @@ export default defineComponent({
|
|
|
70
70
|
const $q = useQuasar();
|
|
71
71
|
const router = useRouter();
|
|
72
72
|
const password = ref("");
|
|
73
|
-
const passwordConfirmation = ref("");
|
|
74
73
|
const loading = ref(false);
|
|
75
74
|
const { t } = useI18n();
|
|
76
75
|
|
|
77
|
-
const canSubmit = computed(() =>
|
|
78
|
-
return password.value != "" &&
|
|
79
|
-
password.value === passwordConfirmation.value
|
|
80
|
-
? false
|
|
81
|
-
: true;
|
|
82
|
-
});
|
|
76
|
+
const canSubmit = computed(() => password.value.length < 6);
|
|
83
77
|
|
|
84
78
|
const validations = {
|
|
85
79
|
passwordRules: [
|
|
86
|
-
(val: string) => !!val || t("auth.
|
|
87
|
-
|
|
88
|
-
passwordConfirmationRules: [
|
|
89
|
-
(val: string) =>
|
|
90
|
-
val === password.value || t("auth.newPasswordConfirmationFailed"),
|
|
80
|
+
(val: string) => !!val || t("auth.passwordPresenceError"),
|
|
81
|
+
(val: string) => val.length >= 6 || t("auth.passwordLengthError"),
|
|
91
82
|
],
|
|
92
83
|
};
|
|
93
84
|
|
|
94
85
|
const onSubmit = () => {
|
|
95
86
|
const data = {
|
|
96
87
|
password: password.value,
|
|
97
|
-
password_confirmation: passwordConfirmation.value,
|
|
98
88
|
};
|
|
99
89
|
patch(AUTH_SERVER_UPDATE_PASSWORD_ROUTE, data)
|
|
100
90
|
.then(() => {
|
|
@@ -116,7 +106,6 @@ export default defineComponent({
|
|
|
116
106
|
|
|
117
107
|
return {
|
|
118
108
|
password,
|
|
119
|
-
passwordConfirmation,
|
|
120
109
|
validations,
|
|
121
110
|
loading,
|
|
122
111
|
onSubmit,
|
|
@@ -127,13 +116,8 @@ export default defineComponent({
|
|
|
127
116
|
</script>
|
|
128
117
|
|
|
129
118
|
<style scoped>
|
|
130
|
-
.
|
|
119
|
+
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap");
|
|
131
120
|
.q-page {
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.q-card {
|
|
136
|
-
width: 400px;
|
|
137
|
-
padding: 50px;
|
|
121
|
+
font-family: "Montserrat", sans-serif;
|
|
138
122
|
}
|
|
139
123
|
</style>
|
package/src/routes/index.ts
CHANGED
package/src/store/index.ts
CHANGED
|
@@ -34,6 +34,16 @@ const mutations: MutationTree<tokenStateInterface> = {
|
|
|
34
34
|
},
|
|
35
35
|
setPayload(state, value: payload) {
|
|
36
36
|
state.payload = {...value}
|
|
37
|
+
},
|
|
38
|
+
reset(state) {
|
|
39
|
+
state.raw = ""
|
|
40
|
+
state.payload = {
|
|
41
|
+
company_hp: undefined,
|
|
42
|
+
exp: undefined,
|
|
43
|
+
gm_key: "",
|
|
44
|
+
roles: [],
|
|
45
|
+
sub: null
|
|
46
|
+
}
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
|