@oniti/quasar-app-extension-vlank-auth 3.2.24 → 3.2.26
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 +38 -2
- package/package.json +1 -1
- package/src/boot/index.js +7 -3
- package/src/components/pages/Login.vue +4 -0
package/README.md
CHANGED
|
@@ -23,9 +23,43 @@ quasar ext remove @oniti/vlank-auth
|
|
|
23
23
|
yarn upgrade @oniti/vlank-auth
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
###
|
|
26
|
+
### Live extension development
|
|
27
27
|
```bash
|
|
28
|
-
#
|
|
28
|
+
# in this extension root directory (once for all):
|
|
29
|
+
yarn link
|
|
30
|
+
|
|
31
|
+
# in host project (laravel-vlank, probably) frontend directory:
|
|
32
|
+
# (delete node_modules + yarn install to get to the original state)
|
|
33
|
+
yarn link "@oniti/quasar-app-extension-vlank-auth"
|
|
34
|
+
```
|
|
35
|
+
In quasar.conf.js of host project:
|
|
36
|
+
```javascript
|
|
37
|
+
devServer: {
|
|
38
|
+
…
|
|
39
|
+
watchFiles: [
|
|
40
|
+
'/node_modules/@oniti/quasar-app-extension-vlank-auth/src/**/*',
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Live extension development (alternative)
|
|
46
|
+
I (Julien) was unable to make the above work ("missing index script") so I use this instead:
|
|
47
|
+
```bash
|
|
48
|
+
# delete the src subdirectory of the extension in the host project (in front-end directory):
|
|
49
|
+
rm -rf node_modules/@oniti/quasar-app-extension-vlank-auth/src
|
|
50
|
+
# link directly the src directory of the extension:
|
|
51
|
+
ln -s /home/xfennec/git/vlank-auth/src/ node_modules/@oniti/quasar-app-extension-vlank-auth/src
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
That's it. The extension is already in devServer's watchFiles of laravel-vlank,
|
|
55
|
+
so it will be reloaded automatically when you change something in the extension.
|
|
56
|
+
|
|
57
|
+
edit: I was also able to make it work by modifying files in node_modules and
|
|
58
|
+
running `quasar clean` in the host project + restarting `./serve.sh` for quick tests.
|
|
59
|
+
|
|
60
|
+
### Publish
|
|
61
|
+
```bash
|
|
62
|
+
# only necessary step (asks for new version):
|
|
29
63
|
yarn publish
|
|
30
64
|
```
|
|
31
65
|
|
|
@@ -101,6 +135,7 @@ Route example:
|
|
|
101
135
|
// passwordCreateRoute : '/', // optional, defaultpasswordCreateRoute otherwise
|
|
102
136
|
rights : ['admin-panel'] // optional
|
|
103
137
|
logoutOnUnsufisantRights: true, // optional
|
|
138
|
+
// ignoreAuthRedirect: true // optional
|
|
104
139
|
},
|
|
105
140
|
component: () => import('layouts/MainLayout.vue'),
|
|
106
141
|
children: [
|
|
@@ -121,6 +156,7 @@ Route example:
|
|
|
121
156
|
| rights | array of required rights, a message will pop if **any** right is missing! |
|
|
122
157
|
| typeRightCheck | string, "any" or "all" define if all rights are requiered or only one |
|
|
123
158
|
| logoutOnUnsufisantRights | self explaining :) |
|
|
159
|
+
| ignoreAuthRedirect | if true, no redirection will be done on this **public** route (useful for pages where you want to preserve query params) |
|
|
124
160
|
|
|
125
161
|
## Helpers
|
|
126
162
|
|
package/package.json
CHANGED
package/src/boot/index.js
CHANGED
|
@@ -9,10 +9,10 @@ export default boot(({ app, router, store }) => {
|
|
|
9
9
|
const config = app.config.globalProperties.$q.config.onitiVlankAuth;
|
|
10
10
|
const configFramework = app.config.globalProperties.$q.config.onitiVlankAuthConfig ? app.config.globalProperties.$q.config.onitiVlankAuthConfig : {};
|
|
11
11
|
|
|
12
|
-
// Fonction permettant de
|
|
12
|
+
// Fonction permettant de gérer la redirection en cas de compte non loggué
|
|
13
13
|
router.beforeEach((to, from, next) => {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Défini les routes de redirection et de login
|
|
16
16
|
*/
|
|
17
17
|
const routesToSet = {
|
|
18
18
|
loginRoute: { default: "defaultAuthRoute", mutation: "SET_LOGIN_ROUTE" },
|
|
@@ -116,6 +116,7 @@ export default boot(({ app, router, store }) => {
|
|
|
116
116
|
{
|
|
117
117
|
path: ":token",
|
|
118
118
|
component: () => import("../components/pages/PasswordReset.vue"),
|
|
119
|
+
meta: { ignoreAuthRedirect: true },
|
|
119
120
|
},
|
|
120
121
|
],
|
|
121
122
|
},
|
|
@@ -182,7 +183,10 @@ export default boot(({ app, router, store }) => {
|
|
|
182
183
|
: config.defaultRedirectRoute;
|
|
183
184
|
route_to_go = redirectRoute;
|
|
184
185
|
}
|
|
185
|
-
|
|
186
|
+
|
|
187
|
+
const ignoreRedirect = router.currentRoute.value.matched.some(record => record.meta.ignoreAuthRedirect);
|
|
188
|
+
|
|
189
|
+
if (!ignoreRedirect && router.currentRoute.value.path !== route_to_go) {
|
|
186
190
|
router.push(route_to_go);
|
|
187
191
|
}
|
|
188
192
|
resolve();
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="absolute-center container">
|
|
3
|
+
<!--
|
|
4
|
+
Attention avec Firefox, le logo DOIT avoir un width et un height dans
|
|
5
|
+
le fichier SVG lui-même, sinon il apparaitra avec de mauvaises proportions.
|
|
6
|
+
-->
|
|
3
7
|
<q-img alt="" class="logo q-mb-md" :src="getLogoImage()" />
|
|
4
8
|
<q-card class="fit column q-pa-lg login-form-container">
|
|
5
9
|
<vlank-input
|