@oniti/quasar-app-extension-vlank-auth 3.2.2 → 3.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/README.md CHANGED
@@ -47,19 +47,34 @@ chainWebpack(chain) {
47
47
  }
48
48
  ```
49
49
  ### Configuration Optional
50
+ You can define a custom function to check route access.
51
+
52
+ in `quasar.conf.js`
50
53
  ```javascript
54
+ boot: [...,'override-check-route-access'],
55
+ ...,
51
56
  framework:{
52
57
  ...,
53
58
  config:{
54
59
  onitiVlankAuth: {
55
- check_route_access_overide: (user, to) =>{
56
- return false
57
- }
60
+ check_route_access_overide_name: "$vlankAuthCheckAccessRoute"
58
61
  },
59
62
  ...
60
63
  }
61
64
  }
62
65
  ```
66
+ `override-check-route-access.js`
67
+ ```javascript
68
+ import { boot } from 'quasar/wrappers'
69
+
70
+
71
+ export default boot(({ app }) => {
72
+ app.config.globalProperties.$vlankAuthCheckAccessRoute = (user, to) => {
73
+ return true
74
+ }
75
+ })
76
+ ```
77
+
63
78
  ### Usage
64
79
  Just add requieresAuth as meta on route to require an auth.
65
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oniti/quasar-app-extension-vlank-auth",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "Authentification",
5
5
  "author": "François BOUYER <francois@oniti.fr>",
6
6
  "license": "MIT",
package/src/boot/index.js CHANGED
@@ -7,6 +7,7 @@ export default boot(({ app, router, store }) => {
7
7
  store.registerModule("auth", auth);
8
8
 
9
9
  const config = app.config.globalProperties.$q.config.onitiVlankAuth;
10
+ const configFramework = app.config.globalProperties.$q.config.onitiVlankAuthConfig ? app.config.globalProperties.$q.config.onitiVlankAuthConfig : {};
10
11
 
11
12
  // Fonction permettant de géré la redirection en cas decompte non loggué
12
13
  router.beforeEach((to, from, next) => {
@@ -42,7 +43,8 @@ export default boot(({ app, router, store }) => {
42
43
  typeRightCheck = typeRightCheck ? typeRightCheck.meta.typeRightCheck : "all";
43
44
 
44
45
  const getter_right_check = typeRightCheck === "any" ? "auth/checkAny" : "auth/checkAll";
45
- const check_route_access_overide = config.check_route_access_overide;
46
+ const check_route_access_overide_name = configFramework.check_route_access_overide_name;
47
+ const check_route_access_overide = app.config.globalProperties[check_route_access_overide_name];
46
48
 
47
49
  let logoutOnUnsufisantRights = to.matched.find((r) =>
48
50
  r.meta.hasOwnProperty("logoutOnUnsufisantRights")
@@ -58,7 +60,7 @@ export default boot(({ app, router, store }) => {
58
60
  // eslint-disable-next-line
59
61
  if (store.getters["auth/isAuthenticated"]) {
60
62
  // Pas les droits nécéssaires
61
- if ((check_route_access_overide && check_route_access_overide(store.getters['user'],to)) || (!check_route_access_overide &&!store.getters[getter_right_check](rights))) {
63
+ if ((check_route_access_overide && !check_route_access_overide(store.getters['auth/user'],to)) || (!check_route_access_overide &&!store.getters[getter_right_check](rights))) {
62
64
  if (logoutOnUnsufisantRights) {
63
65
  store.dispatch("auth/logout");
64
66
  next(helper.getLoginRoute());
@@ -8,7 +8,7 @@
8
8
  rounded
9
9
  class="login"
10
10
  color="primary q-mb-md"
11
- label="Adresse mail"
11
+ :label="$q.i18n.auth.email"
12
12
  name="login"
13
13
  @enter-press="submitConnexion"
14
14
  >
@@ -22,7 +22,7 @@
22
22
  rounded
23
23
  :type="isPwd ? 'password' : 'text'"
24
24
  class="login"
25
- label="Mot de passe"
25
+ :label="$q.i18n.auth.password"
26
26
  name="password"
27
27
  @enter-press="submitConnexion"
28
28
  >
@@ -40,7 +40,7 @@
40
40
  <q-btn
41
41
  class="q-ma-md float-right connexion-btn"
42
42
  color="accent"
43
- label="Connexion"
43
+ :label="$q.i18n.auth.signin"
44
44
  rounded
45
45
  unelevated
46
46
  @click="submitConnexion"
@@ -50,7 +50,7 @@
50
50
  color="accent"
51
51
  type="a"
52
52
  :href="getUrlPasswordLost"
53
- label="Mot de passe oublié ?"
53
+ :label="$q.i18n.auth.forgetPassword"
54
54
  />
55
55
  <div class="text-logo">
56
56
  <a href="https://www.oniti.fr/"><img alt="Oniti.fr" :src="getLogoBottomImage()" /></a>
@@ -9,7 +9,7 @@
9
9
  rounded
10
10
  class="login"
11
11
  color="primary q-mb-md"
12
- label="Adresse mail"
12
+ :label="$q.i18n.auth.email"
13
13
  name="login"
14
14
  @enter-press="submitPasswordLost"
15
15
  >
@@ -20,7 +20,7 @@
20
20
  <q-btn
21
21
  class="q-ma-md float-right connexion-btn"
22
22
  color="accent"
23
- label="Envoyer"
23
+ :label="$q.i18n.auth.send"
24
24
  rounded
25
25
  unelevated
26
26
  @click="submitPasswordLost"
@@ -29,7 +29,7 @@
29
29
  flat
30
30
  color="accent"
31
31
  type="a"
32
- label="Retour à l'écran de connexion"
32
+ :label="$q.i18n.auth.goBackToLogin"
33
33
  @click="onClickBackLogin"
34
34
  />
35
35
  <div class="text-logo">
@@ -8,7 +8,7 @@
8
8
  rounded
9
9
  class="login"
10
10
  color="primary q-mb-md"
11
- label="Nouveau mot de passe"
11
+ :label="$q.i18n.auth.newPassword"
12
12
  name="new_password"
13
13
  :type="isNewPwd ? 'password' : 'text'"
14
14
  @enter-press="submitPassword"
@@ -30,7 +30,7 @@
30
30
  rounded
31
31
  class="login"
32
32
  color="primary q-mb-md"
33
- label="Confirmation du mot de passe"
33
+ :label="$q.i18n.auth.confirmPassword"
34
34
  name="password_confirm"
35
35
  :type="isConfirmPwd ? 'password' : 'text'"
36
36
  @enter-press="submitPassword"
@@ -49,7 +49,7 @@
49
49
  <q-btn
50
50
  class="q-ma-md float-right connexion-btn"
51
51
  color="accent"
52
- label="Envoyer"
52
+ :label="$q.i18n.auth.send"
53
53
  rounded
54
54
  unelevated
55
55
  @click="submitPassword"