@sowell/quasar-app-extension-auth 0.3.19 → 0.3.21

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.3.19",
3
+ "version": "0.3.21",
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",
@@ -78,11 +78,11 @@
78
78
  </div>
79
79
  <div
80
80
  class="column col justify-center content-center mobile"
81
- :style="isManager ? 'background: #eef8fd' : ''"
82
- :class="!isManager ? 'bgBlue' : ''"
81
+ :style="IS_MANAGER ? 'background: #eef8fd' : ''"
82
+ :class="!IS_MANAGER ? 'bgBlue' : ''"
83
83
  >
84
84
  <img
85
- v-if="isManager"
85
+ v-if="IS_MANAGER"
86
86
  src="../../assets/illustration-login.svg"
87
87
  class="q-pl-md q-pr-md logoWhite"
88
88
  />
@@ -151,6 +151,7 @@ export default defineComponent({
151
151
  icons,
152
152
  } = useAuth();
153
153
 
154
+ const IS_MANAGER = ["manager", "clean_manager"].includes(X_REQUESTED_ROLES);
154
155
  const isNotification = ref(false);
155
156
  const infoDialog = ref({
156
157
  title: "",
@@ -167,7 +168,6 @@ export default defineComponent({
167
168
  password.value.length > 5
168
169
  ),
169
170
  );
170
- const isManager = computed(() => X_REQUESTED_ROLES === "clean_manager");
171
171
  const resetPassword = async (email: string) => {
172
172
  const data = {
173
173
  auth: {
@@ -206,7 +206,7 @@ export default defineComponent({
206
206
  forgottenPassword,
207
207
  emailResetPassword,
208
208
  isNotification,
209
- isManager,
209
+ IS_MANAGER,
210
210
  WELCOME_SUBTITLE,
211
211
  WELCOME_TITLE,
212
212
  isSubmitBtnDisabled,
@@ -87,23 +87,20 @@ export function useAuth() {
87
87
  if (requestedRoles) options.headers["x-requested-roles"] = requestedRoles;
88
88
 
89
89
  try {
90
- await authState.signin(data, options);
90
+ await authState.signin(data, options)
91
+ loading.value = false;
91
92
  // @ts-ignore
92
93
  if (!window.Cypress) {
93
- const isDifferentUser =
94
- !localStorage.getItem("credentials") ||
95
- // @ts-ignore
96
- JSON.parse(localStorage.getItem("credentials")).email !== data.auth.email;
97
-
98
- if (isDifferentUser) {
99
- localStorage.setItem("credentials", JSON.stringify(data.auth));
100
- }
94
+ // FIXME: encrypt password
95
+ localStorage.setItem("credentials", JSON.stringify(data.auth))
101
96
  }
102
97
  push(LOCAL_SUCCESS_REDIRECTION_ROUTE);
103
- loading.value = false;
104
- } catch (err) {
98
+ }
99
+ catch(err) {
100
+ console.error("onSubmit", err)
105
101
  loading.value = false;
106
102
  }
103
+
107
104
  };
108
105
 
109
106
  const isSubmitBtnDisabled = () => {
@@ -12,7 +12,7 @@ const {
12
12
  } = prompts;
13
13
 
14
14
  // FIXME: Utiliser le UI_PAGE pour choisir les page a utiliser pour la version web ou mobile (auth et reset password)
15
- const webAuthRoles = ["superadmin", "clean_manager"];
15
+ const webAuthRoles = ["superadmin", "clean_manager", "manager"];
16
16
 
17
17
  let mobileAuthPage = "";
18
18