@sowell/quasar-app-extension-auth 1.1.2 → 1.2.1

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": "1.1.2",
3
+ "version": "1.2.1",
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",
@@ -23,6 +23,7 @@
23
23
  "devDependencies": {
24
24
  "@quasar/app-webpack": "^4.0.0-beta.16",
25
25
  "@quasar/cli": "^2.2.3",
26
+ "@types/crypto-js": "^4.2.2",
26
27
  "@types/node": "^16.9.1",
27
28
  "@types/validator": "^13.6.3",
28
29
  "@typescript-eslint/eslint-plugin": "^5.10.0",
@@ -162,7 +162,6 @@ import SowellMessage from "../dialogs/Message.vue"
162
162
  import MicrosoftLogo from "../../assets/logo-microsoft.svg"
163
163
 
164
164
  import { useAuth } from "composables/auth"
165
- import { send } from "process"
166
165
 
167
166
  export default defineComponent({
168
167
  name: "Auth",
@@ -95,6 +95,41 @@
95
95
  style="font-size: 14px; cursor: pointer; width: 350px">
96
96
  {{ $t("auth.forgottenPassword") }}
97
97
  </div>
98
+ <div v-if="USE_SSO">
99
+ <div
100
+ style="
101
+ display: flex;
102
+ justify-content: space-between;
103
+ align-items: center;
104
+ ">
105
+ <div
106
+ style="
107
+ width: 35%;
108
+ border: 1px solid #bcc3c7;
109
+ height: 1px;
110
+ "></div>
111
+ <div class="text-weight-bold">{{ $t("common.or") }}</div>
112
+ <div
113
+ style="
114
+ width: 35%;
115
+ border: 1px solid #bcc3c7;
116
+ height: 1px;
117
+ "></div>
118
+ </div>
119
+ <q-btn
120
+ data-cy="submit-sso-login"
121
+ :label="$t('auth.msalLogin')"
122
+ color="primary"
123
+ no-caps
124
+ unelevated
125
+ text-color="black"
126
+ :loading="msalLoading"
127
+ :disable="msalLoading || loading"
128
+ :icon="`img:${MicrosoftLogo}`"
129
+ class="full-width q-mt-lg"
130
+ @click="msalAuth"
131
+ outline />
132
+ </div>
98
133
  </div>
99
134
  </q-form>
100
135
  </div>
@@ -154,6 +189,7 @@ import SendEmail from "../dialogs/SendEmail.vue"
154
189
  import SowellMessage from "../dialogs/Message.vue"
155
190
  import { useAuth } from "composables/auth"
156
191
  import { AxiosError } from "axios"
192
+ import MicrosoftLogo from "../../assets/logo-microsoft.svg"
157
193
 
158
194
  export default defineComponent({
159
195
  name: "Auth",
@@ -175,6 +211,9 @@ export default defineComponent({
175
211
  APP_SERVER_BASE_URL,
176
212
  IS_OTP,
177
213
  icons,
214
+ USE_SSO,
215
+ msalAuth,
216
+ msalLoading,
178
217
  onSubmit,
179
218
  retypeEmail,
180
219
  isSubmitBtnDisabled,
@@ -209,8 +248,7 @@ export default defineComponent({
209
248
  if ((error as AxiosError).response?.status === 403) {
210
249
  // NOTE: 403 is returned when the user is not allowed to reset the password
211
250
  sendEmailCode.value = 403
212
- }
213
- else {
251
+ } else {
214
252
  sendEmailCode.value = 404
215
253
  }
216
254
  isReset.value = true
@@ -239,6 +277,10 @@ export default defineComponent({
239
277
  goToOtpValidation,
240
278
  isSubmitBtnDisabled,
241
279
  retypeEmail,
280
+ msalLoading,
281
+ USE_SSO,
282
+ msalAuth,
283
+ MicrosoftLogo,
242
284
  handleSubmit,
243
285
  resetPassword
244
286
  }
@@ -8,10 +8,7 @@
8
8
  class="q-mb-sm q-mr-md"
9
9
  style="width: 190px" />
10
10
  </div>
11
- <div
12
- class="column justify-center full-height"
13
- style="max-width: 550px; margin-top: -90px">
14
- <div></div>
11
+ <div class="column justify-center full-height" style="max-width: 550px">
15
12
  <div
16
13
  class="text-subtitle1 q-mt-lg"
17
14
  style="font-size: 34px; font-weight: 600; line-height: 34px">
@@ -43,10 +40,11 @@
43
40
  class="full-width q-mb-md">
44
41
  <template #append>
45
42
  <q-icon
46
- :name="showPassword
47
- ? icons.ionEyeOffOutline
48
- : icons.ionEyeOutline
49
- "
43
+ :name="
44
+ showPassword
45
+ ? icons.ionEyeOffOutline
46
+ : icons.ionEyeOutline
47
+ "
50
48
  class="cursor-pointer q-mr-sm"
51
49
  @click="showPassword = !showPassword" />
52
50
  </template>
@@ -108,7 +106,7 @@ export default defineComponent({
108
106
  canSubmit,
109
107
  passwordUpdated,
110
108
  showPassword,
111
- icons,
109
+ icons,
112
110
  goToLoginPage,
113
111
  onSubmit
114
112
  }
@@ -1,9 +1,15 @@
1
- import CryptoJS from "crypto-js";
1
+ import CryptoJS from "crypto-js"
2
2
 
3
3
  export function encrypt(password: string): string {
4
- return CryptoJS.AES.encrypt(password, process.env.ENCRYPTION_KEY).toString()
4
+ const key = process.env.ENCRYPTION_KEY
5
+ if (!key) throw new Error(" is not defined")
6
+ return CryptoJS.AES.encrypt(password, key).toString()
5
7
  }
6
8
 
7
9
  export function decrypt(encryptedPassword: string): string {
8
- return CryptoJS.AES.decrypt(encryptedPassword, process.env.ENCRYPTION_KEY).toString(CryptoJS.enc.Utf8)
10
+ const key = process.env.ENCRYPTION_KEY
11
+ if (!key) throw new Error("ENCRYPTION_KEY is not defined")
12
+ return CryptoJS.AES.decrypt(encryptedPassword, key).toString(
13
+ CryptoJS.enc.Utf8
14
+ )
9
15
  }