@oniti/quasar-app-extension-vlank-auth 3.0.2 → 3.2.0
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/README.md
CHANGED
|
@@ -35,6 +35,10 @@ chainWebpack(chain) {
|
|
|
35
35
|
__dirname,
|
|
36
36
|
"src/assets/logo-app.png"
|
|
37
37
|
),
|
|
38
|
+
"vlank-auth-logo-text": path.resolve(
|
|
39
|
+
__dirname,
|
|
40
|
+
"src/assets/logo-app-text.png"
|
|
41
|
+
),
|
|
38
42
|
"vlank-auth-layout": path.resolve(
|
|
39
43
|
__dirname,
|
|
40
44
|
"src/layouts/EmptyLayout.vue"
|
|
@@ -76,6 +80,7 @@ Route example:
|
|
|
76
80
|
| passwordLostRoute | Override default "passwordLostRoute" route |
|
|
77
81
|
| passwordCreateRoute | Override default "passwordCreateRoute" route |
|
|
78
82
|
| rights | array of required rights, a message will pop if **any** right is missing! |
|
|
83
|
+
| typeRightCheck | string, "any" or "all" define if all rights are requiered or only one |
|
|
79
84
|
| logoutOnUnsufisantRights | self explaining :) |
|
|
80
85
|
|
|
81
86
|
## Helpers
|
package/package.json
CHANGED
package/src/boot/index.js
CHANGED
|
@@ -38,6 +38,11 @@ export default boot(({ app, router, store }) => {
|
|
|
38
38
|
let rights = to.matched.find((r) => r.meta.rights);
|
|
39
39
|
rights = rights ? rights.meta.rights : [];
|
|
40
40
|
|
|
41
|
+
let typeRightCheck = to.matched.find((r) => r.meta.typeRightCheck);
|
|
42
|
+
typeRightCheck = typeRightCheck ? typeRightCheck.meta.typeRightCheck : "all";
|
|
43
|
+
|
|
44
|
+
const getter_right_check = typeRightCheck === "any" ? "auth/checkAny" : "auth/checkAll";
|
|
45
|
+
|
|
41
46
|
let logoutOnUnsufisantRights = to.matched.find((r) =>
|
|
42
47
|
r.meta.hasOwnProperty("logoutOnUnsufisantRights")
|
|
43
48
|
);
|
|
@@ -52,7 +57,7 @@ export default boot(({ app, router, store }) => {
|
|
|
52
57
|
// eslint-disable-next-line
|
|
53
58
|
if (store.getters["auth/isAuthenticated"]) {
|
|
54
59
|
// Pas les droits nécéssaires
|
|
55
|
-
if (!store.getters[
|
|
60
|
+
if (!store.getters[getter_right_check](rights)) {
|
|
56
61
|
if (logoutOnUnsufisantRights) {
|
|
57
62
|
store.dispatch("auth/logout");
|
|
58
63
|
next(helper.getLoginRoute());
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="absolute-center container">
|
|
3
|
-
<q-card class="fit column q-pa-lg">
|
|
3
|
+
<q-card class="fit column q-pa-lg login-form-container">
|
|
4
4
|
<q-img alt="" class="logo q-mb-md" :src="getLogoImage()" />
|
|
5
5
|
<vlank-input
|
|
6
6
|
v-model="login"
|
|
7
|
-
|
|
7
|
+
outlined
|
|
8
|
+
rounded
|
|
9
|
+
class="login"
|
|
8
10
|
color="primary q-mb-md"
|
|
9
11
|
label="Adresse mail"
|
|
10
12
|
name="login"
|
|
@@ -16,8 +18,10 @@
|
|
|
16
18
|
</vlank-input>
|
|
17
19
|
<vlank-input
|
|
18
20
|
v-model="password"
|
|
21
|
+
outlined
|
|
22
|
+
rounded
|
|
19
23
|
:type="isPwd ? 'password' : 'text'"
|
|
20
|
-
class="
|
|
24
|
+
class="login"
|
|
21
25
|
label="Mot de passe"
|
|
22
26
|
name="password"
|
|
23
27
|
@enter-press="submitConnexion"
|
|
@@ -34,9 +38,10 @@
|
|
|
34
38
|
</template>
|
|
35
39
|
</vlank-input>
|
|
36
40
|
<q-btn
|
|
37
|
-
class="q-ma-md float-right"
|
|
41
|
+
class="q-ma-md float-right connexion-btn"
|
|
38
42
|
color="accent"
|
|
39
|
-
label="
|
|
43
|
+
label="Connexion"
|
|
44
|
+
rounded
|
|
40
45
|
unelevated
|
|
41
46
|
@click="submitConnexion"
|
|
42
47
|
/>
|
|
@@ -47,16 +52,22 @@
|
|
|
47
52
|
:href="getUrlPasswordLost"
|
|
48
53
|
label="Mot de passe oublié ?"
|
|
49
54
|
/>
|
|
55
|
+
<div class="text-logo">
|
|
56
|
+
<a href="https://www.oniti.fr/"><img alt="Oniti.fr" :src="getLogoBottomImage()" /></a>
|
|
57
|
+
</div>
|
|
50
58
|
</q-card>
|
|
51
59
|
</div>
|
|
52
60
|
</template>
|
|
61
|
+
|
|
53
62
|
<script setup>
|
|
54
63
|
import { ref, onMounted, computed, watch, inject } from 'vue'
|
|
55
64
|
import { useStore } from 'vuex'
|
|
56
65
|
import { useQuasar } from 'quasar'
|
|
66
|
+
import { useRouter } from 'vue-router'
|
|
57
67
|
|
|
58
68
|
const store = useStore()
|
|
59
69
|
const $q = useQuasar()
|
|
70
|
+
const $router = useRouter()
|
|
60
71
|
const $auth = inject('vlank-auth')
|
|
61
72
|
|
|
62
73
|
const isPwd = ref(true)
|
|
@@ -69,6 +80,7 @@ const getUrlPasswordLost = computed(() => {
|
|
|
69
80
|
return $q.config.onitiVlankAuth.defaultPasswordLostRoute
|
|
70
81
|
})
|
|
71
82
|
|
|
83
|
+
|
|
72
84
|
const submitConnexion = function () {
|
|
73
85
|
$auth.login({
|
|
74
86
|
email: login.value,
|
|
@@ -80,6 +92,12 @@ const getLogoImage = function () {
|
|
|
80
92
|
return require('vlank-auth-logo')
|
|
81
93
|
}
|
|
82
94
|
|
|
95
|
+
|
|
96
|
+
const getLogoBottomImage = function () {
|
|
97
|
+
return require('vlank-auth-logo-text')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
83
101
|
watch(has_check, (newValue, oldValue) => {
|
|
84
102
|
if(newValue) {
|
|
85
103
|
$q.loading.hide();
|
|
@@ -95,17 +113,38 @@ onMounted(() => {
|
|
|
95
113
|
})
|
|
96
114
|
</script>
|
|
97
115
|
|
|
98
|
-
<style lang="
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
<style lang="scss" scoped>
|
|
117
|
+
|
|
118
|
+
.login-form-container {
|
|
119
|
+
border-radius: 40px;
|
|
120
|
+
min-width: 415px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.connexion-btn {
|
|
124
|
+
padding: 15px
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.logo {
|
|
128
|
+
width: 140px;
|
|
129
|
+
top: -120px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.container {
|
|
133
|
+
.q-card {
|
|
134
|
+
.logo {
|
|
135
|
+
width: 12rem;
|
|
136
|
+
margin-left: auto;
|
|
137
|
+
margin-right: auto;
|
|
138
|
+
margin-bottom: -90px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media(max-width: 768px) {
|
|
144
|
+
.container {
|
|
145
|
+
left: 0;
|
|
146
|
+
width: 100%;
|
|
147
|
+
transform: translate(0, -50%);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
111
150
|
</style>
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="absolute-center container">
|
|
3
|
-
<q-card class="fit column q-pa-lg">
|
|
4
|
-
<img alt="" class="logo q-mb-md" :src="getLogoImage()"/>
|
|
5
|
-
<p
|
|
6
|
-
<vlank-input
|
|
7
|
-
|
|
3
|
+
<q-card class="fit column q-pa-lg login-form-container">
|
|
4
|
+
<q-img alt="" class="logo q-mb-md" :src="getLogoImage()" />
|
|
5
|
+
<p>Un lien vous sera envoyé par email pour réinitialiser votre mot de passe</p>
|
|
6
|
+
<vlank-input
|
|
7
|
+
v-model="login"
|
|
8
|
+
outlined
|
|
9
|
+
rounded
|
|
10
|
+
class="login"
|
|
11
|
+
color="primary q-mb-md"
|
|
12
|
+
label="Adresse mail"
|
|
13
|
+
name="login"
|
|
14
|
+
@enter-press="submitPasswordLost"
|
|
15
|
+
>
|
|
8
16
|
<template v-slot:prepend>
|
|
9
|
-
<q-icon name="mdi-
|
|
17
|
+
<q-icon name="mdi-email" />
|
|
10
18
|
</template>
|
|
11
19
|
</vlank-input>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<q-btn
|
|
21
|
+
class="q-ma-md float-right connexion-btn"
|
|
22
|
+
color="accent"
|
|
23
|
+
label="Envoyer"
|
|
24
|
+
rounded
|
|
25
|
+
unelevated
|
|
26
|
+
@click="submitPasswordLost"
|
|
27
|
+
/>
|
|
28
|
+
<q-btn
|
|
29
|
+
flat
|
|
30
|
+
color="accent"
|
|
31
|
+
type="a"
|
|
32
|
+
label="Retour à l'écran de connexion"
|
|
33
|
+
@click="onClickBackLogin"
|
|
34
|
+
/>
|
|
35
|
+
<div class="text-logo">
|
|
36
|
+
<a href="https://www.oniti.fr/"><img alt="Oniti.fr" :src="getLogoBottomImage()" /></a>
|
|
37
|
+
</div>
|
|
23
38
|
</q-card>
|
|
24
39
|
</div>
|
|
25
40
|
</template>
|
|
@@ -31,7 +46,7 @@ import { useRouter } from 'vue-router'
|
|
|
31
46
|
const $auth = inject('vlank-auth')
|
|
32
47
|
const $router = useRouter()
|
|
33
48
|
|
|
34
|
-
const login = ref(
|
|
49
|
+
const login = ref(null)
|
|
35
50
|
|
|
36
51
|
const submitPasswordLost = function () {
|
|
37
52
|
$auth.passwordLost({
|
|
@@ -44,19 +59,52 @@ const submitPasswordLost = function () {
|
|
|
44
59
|
const getLogoImage = function () {
|
|
45
60
|
return require('vlank-auth-logo')
|
|
46
61
|
}
|
|
62
|
+
|
|
63
|
+
const getLogoBottomImage = function () {
|
|
64
|
+
return require('vlank-auth-logo-text')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const onClickBackLogin = function () {
|
|
68
|
+
$router.push($auth.getLoginRoute())
|
|
69
|
+
}
|
|
47
70
|
</script>
|
|
48
71
|
|
|
49
|
-
<style lang="
|
|
50
|
-
.container
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
<style lang="scss" scoped>
|
|
73
|
+
.login-form-container {
|
|
74
|
+
border-radius: 40px;
|
|
75
|
+
min-width: 415px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.connexion-btn {
|
|
79
|
+
padding: 15px
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.logo {
|
|
83
|
+
width: 140px;
|
|
84
|
+
top: -120px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.container {
|
|
88
|
+
.q-card {
|
|
89
|
+
.logo {
|
|
90
|
+
width: 12rem;
|
|
91
|
+
margin-left: auto;
|
|
92
|
+
margin-right: auto;
|
|
93
|
+
margin-bottom: -90px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
p {
|
|
99
|
+
color: black;
|
|
100
|
+
margin-bottom: 40px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media(max-width: 768px) {
|
|
104
|
+
.container {
|
|
105
|
+
left: 0;
|
|
106
|
+
width: 100%;
|
|
107
|
+
transform: translate(0, -50%);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
62
110
|
</style>
|
|
@@ -1,52 +1,46 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="absolute-center container">
|
|
3
|
-
<q-card class="fit column q-pa-lg">
|
|
4
|
-
<img alt="" class="logo q-mb-md" :src="getLogoImage()" />
|
|
3
|
+
<q-card class="fit column q-pa-lg login-form-container">
|
|
4
|
+
<q-img alt="" class="logo q-mb-md" :src="getLogoImage()" />
|
|
5
5
|
<vlank-input
|
|
6
6
|
v-model="new_password"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
outlined
|
|
8
|
+
rounded
|
|
9
|
+
class="login"
|
|
10
|
+
color="primary q-mb-md"
|
|
11
|
+
label="Nouveau mot de passe"
|
|
10
12
|
name="new_password"
|
|
11
13
|
@enter-press="submitPassword"
|
|
12
14
|
>
|
|
13
15
|
<template v-slot:prepend>
|
|
14
|
-
<q-icon name="mdi-
|
|
15
|
-
</template>
|
|
16
|
-
<template v-slot:append>
|
|
17
|
-
<q-icon
|
|
18
|
-
:name="isPwd ? 'mdi-eye-off' : 'mdi-eye'"
|
|
19
|
-
class="cursor-pointer"
|
|
20
|
-
@click="isPwd = !isPwd"
|
|
21
|
-
/>
|
|
16
|
+
<q-icon name="mdi-email" />
|
|
22
17
|
</template>
|
|
23
18
|
</vlank-input>
|
|
24
19
|
<vlank-input
|
|
25
20
|
v-model="password_confirm"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
outlined
|
|
22
|
+
rounded
|
|
23
|
+
class="login"
|
|
24
|
+
color="primary q-mb-md"
|
|
25
|
+
label="Confirmation du mot de passe"
|
|
29
26
|
name="password_confirm"
|
|
30
27
|
@enter-press="submitPassword"
|
|
31
28
|
>
|
|
32
29
|
<template v-slot:prepend>
|
|
33
|
-
<q-icon name="mdi-
|
|
34
|
-
</template>
|
|
35
|
-
<template v-slot:append>
|
|
36
|
-
<q-icon
|
|
37
|
-
:name="isPwd ? 'mdi-eye-off' : 'mdi-eye'"
|
|
38
|
-
class="cursor-pointer"
|
|
39
|
-
@click="isPwd = !isPwd"
|
|
40
|
-
/>
|
|
30
|
+
<q-icon name="mdi-email" />
|
|
41
31
|
</template>
|
|
42
32
|
</vlank-input>
|
|
43
33
|
<q-btn
|
|
44
|
-
class="q-ma-md float-right"
|
|
34
|
+
class="q-ma-md float-right connexion-btn"
|
|
45
35
|
color="accent"
|
|
46
|
-
label="
|
|
36
|
+
label="Envoyer"
|
|
37
|
+
rounded
|
|
47
38
|
unelevated
|
|
48
39
|
@click="submitPassword"
|
|
49
40
|
/>
|
|
41
|
+
<div class="text-logo">
|
|
42
|
+
<a href="https://www.oniti.fr/"><img alt="Oniti.fr" :src="getLogoBottomImage()" /></a>
|
|
43
|
+
</div>
|
|
50
44
|
</q-card>
|
|
51
45
|
</div>
|
|
52
46
|
</template>
|
|
@@ -69,49 +63,78 @@ const new_password = ref("")
|
|
|
69
63
|
const password_confirm = ref("")
|
|
70
64
|
|
|
71
65
|
const has_check = computed(() => {
|
|
72
|
-
|
|
66
|
+
return store.state.auth.has_check
|
|
73
67
|
})
|
|
74
68
|
|
|
75
69
|
const submitPassword = function () {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
$auth.resetPassword({
|
|
71
|
+
new_password: new_password.value,
|
|
72
|
+
password_confirm: password_confirm.value,
|
|
73
|
+
token: token.value
|
|
74
|
+
}).then(()=> {
|
|
75
|
+
$router.push($auth.getLoginRoute())
|
|
76
|
+
});
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
const getLogoImage = function () {
|
|
86
80
|
return require('vlank-auth-logo')
|
|
87
81
|
}
|
|
88
82
|
|
|
83
|
+
const getLogoBottomImage = function () {
|
|
84
|
+
return require('vlank-auth-logo-text')
|
|
85
|
+
}
|
|
86
|
+
|
|
89
87
|
watch(has_check, (newValue, oldValue) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
if(newValue) {
|
|
89
|
+
$q.loading.hide();
|
|
90
|
+
}
|
|
93
91
|
})
|
|
94
92
|
|
|
95
93
|
onMounted(() => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
if(!store.state.auth.has_check){
|
|
95
|
+
$q.loading.show({
|
|
96
|
+
delay: 0, // ms
|
|
97
|
+
})
|
|
98
|
+
}
|
|
101
99
|
})
|
|
102
100
|
</script>
|
|
103
101
|
|
|
104
|
-
<style lang="
|
|
105
|
-
.container
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
margin-left: auto
|
|
110
|
-
margin-right: auto
|
|
102
|
+
<style lang="scss" scoped>
|
|
103
|
+
.login-form-container {
|
|
104
|
+
border-radius: 40px;
|
|
105
|
+
min-width: 415px;
|
|
106
|
+
}
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
.connexion-btn {
|
|
109
|
+
padding: 15px
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.logo {
|
|
113
|
+
width: 140px;
|
|
114
|
+
top: -120px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.container {
|
|
118
|
+
.q-card {
|
|
119
|
+
.logo {
|
|
120
|
+
width: 12rem;
|
|
121
|
+
margin-left: auto;
|
|
122
|
+
margin-right: auto;
|
|
123
|
+
margin-bottom: -90px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
p {
|
|
129
|
+
color: black;
|
|
130
|
+
margin-bottom: 40px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media(max-width: 768px) {
|
|
134
|
+
.container {
|
|
135
|
+
left: 0;
|
|
136
|
+
width: 100%;
|
|
137
|
+
transform: translate(0, -50%);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
117
140
|
</style>
|