@sowell/quasar-app-extension-auth 0.2.8 → 0.2.9

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.8",
3
+ "version": "0.2.9",
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",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "axios": "^0.21.1",
42
+ "buffer": "^6.0.3",
42
43
  "qs": "^6.10.1",
43
44
  "validator": "^13.6.0",
44
45
  "vue-i18n": "^9.1.0",
@@ -57,7 +57,7 @@ import { useQuasar } from "quasar";
57
57
  import { useI18n } from "vue-i18n";
58
58
  import { $api, $prompts, $router } from "../../injects";
59
59
  import jwt from 'jwt-decode'
60
- import { Buffer } from 'buffer'
60
+ import { Buffer } from 'buffer/' // NOTE: the trailing '/' is intentional and required by buffer
61
61
 
62
62
  interface DecodedToken { // FIXME: consider to move to its own file
63
63
  sub: number,
@@ -101,18 +101,22 @@ export default defineComponent({
101
101
  passwordConfirmationRules: [
102
102
  (val: string) =>
103
103
  val === password.value || t("auth.newPasswordConfirmationFailed"),
104
- (val: string) => !!val || t("auth.resetPasswordPresenceError"),
105
- (val: string) => val.length >= 6 || t("auth.resetPasswordLengthError"),
104
+ (val: string) => !!val || t("auth.passwordPresenceError"),
105
+ (val: string) => val.length >= 6 || t("auth.passwordLengthError"),
106
106
  ],
107
107
  };
108
108
 
109
109
  const decodeKey = (key: string) => {
110
110
  try {
111
- const decodedKey = Buffer.from(key, "base64").toString("utf-8").split(',')
111
+ // remove backslash to avoid decoding error
112
+ key = key.replace(/\\n/g, '')
113
+ const decodedKey = Buffer.from(key, 'base64').toString('utf-8').split(',')
114
+ // split instead of JSON.parse as JSON.parse doesn't work
115
+
112
116
  if (decodedKey.length !== 2) {
113
117
  throw 'Invalid encoded key'
114
118
  }
115
- console.log('decodedKey', decodedKey)
119
+
116
120
  const email = decodedKey[0].replace('{', '').split(':')[1]
117
121
  const tmpToken = decodedKey[1].replace('}', '').split(':')[1]
118
122
  return {
@@ -15,6 +15,13 @@ export default {
15
15
  tapEmail: "Please enter your email",
16
16
  404: "No user found with the provided credentials",
17
17
  403: "Insufficient rights, your account does not allow access to this interface",
18
+ passwordRecovery: 'Password recovery',
19
+ newPassword: 'New password',
20
+ newPasswordConfirmationFailed: "The passwords you typed don't match",
21
+ passwordRecoverySuccess: 'Your password has been updated',
22
+ passwordRecoveryFailed: 'An error occured while updating your password',
23
+ passwordRecoveryExpiredLink: 'The link expired',
24
+ passwordRecoveryInvalidLink: 'the link is invalid'
18
25
  },
19
26
  common: {
20
27
  register: "Save",
@@ -15,9 +15,16 @@ export default {
15
15
  tapEmail: "Entrer votre email",
16
16
  404: "Aucun utilisateur trouvé avec les identifiants donnés",
17
17
  403: "Droits insuffisants, votre compte ne permet pas d'acceder à cette interface",
18
+ passwordRecovery: 'Récupération de mot de passe',
19
+ newPassword: 'Nouveau mot de passe',
20
+ newPasswordConfirmationFailed: 'Les mot de passes que vous avez saisi ne correspondent pas',
21
+ passwordRecoverySuccess: 'Votre mot de passe a été mis à jour',
22
+ passwordRecoveryFailed: "Une erreur s'est produite lors de la mise à jour de votre mot de passe",
23
+ passwordRecoveryExpiredLink: 'Lien de récupération expiré',
24
+ passwordRecoveryInvalidLink: 'Lien de récupération invalide'
18
25
  },
19
26
  common: {
20
- register: "Enregistre",
27
+ register: "Enregistrer",
21
28
  send: "Envoyer",
22
29
  cancel: "Annuler",
23
30
  },