@tapni/auth 0.0.169 → 0.0.171

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.
Files changed (69) hide show
  1. package/README.md +2 -0
  2. package/dist/.vite/manifest.json +18 -10
  3. package/dist/.well-known/assetlinks.json +10 -12
  4. package/dist/.well-known/microsoft-identity-association.json +5 -5
  5. package/dist/{Account-ja1hZJy5.js → Account-BB71UmF3.js} +31 -32
  6. package/dist/{QR-ybXT1KGe.js → QR-BJnR_0ci.js} +3 -3
  7. package/dist/TapniAuth.es.js +1 -1
  8. package/dist/TapniAuth.umd.js +9 -9
  9. package/dist/blank.html +31 -0
  10. package/dist/{install-4aK3Wz63.js → install-Cx9Gi17U.js} +753 -997
  11. package/dist/site.webmanifest +11 -1
  12. package/dist/style.css +1 -1
  13. package/dist/{web-NrPZl3qD.js → web-XbruGdlD.js} +2 -5
  14. package/package.json +64 -55
  15. package/src/.prettierrc.json +16 -0
  16. package/src/App.vue +249 -265
  17. package/src/components/Language.vue +66 -143
  18. package/src/components/LinkIcon.vue +174 -225
  19. package/src/components/ModalOverlay.vue +47 -50
  20. package/src/components/OTP.vue +64 -94
  21. package/src/components/SSO.vue +80 -111
  22. package/src/components/SSOPick.vue +93 -148
  23. package/src/eslint.config.js +15 -0
  24. package/src/install.js +9 -10
  25. package/src/main.js +54 -57
  26. package/src/mixins/apple.mixin.js +56 -54
  27. package/src/mixins/auth.mixin.js +21 -74
  28. package/src/mixins/facebook.mixin.js +67 -66
  29. package/src/mixins/global.mixin.js +107 -109
  30. package/src/mixins/google.mixin.js +53 -54
  31. package/src/mixins/mfa-auth.mixin.js +68 -68
  32. package/src/mixins/microsoft.mixin.js +67 -75
  33. package/src/mixins/okta.mixin.js +50 -57
  34. package/src/mixins/qr-auth.mixin.js +111 -107
  35. package/src/mixins/saml.mixin.js +97 -48
  36. package/src/router/index.js +6 -6
  37. package/src/routes.js +60 -66
  38. package/src/services/Api.js +55 -57
  39. package/src/services/AuthService.js +75 -75
  40. package/src/services/CompanyService.js +10 -10
  41. package/src/services/DeviceService.js +3 -3
  42. package/src/services/UserService.js +45 -45
  43. package/src/services/UtilService.js +256 -218
  44. package/src/store/auth.js +471 -543
  45. package/src/store/constants.js +1 -1
  46. package/src/store/event-bus.js +22 -22
  47. package/src/store/locales/cn.js +442 -458
  48. package/src/store/locales/de.js +438 -517
  49. package/src/store/locales/en.js +449 -510
  50. package/src/store/locales/es.js +442 -524
  51. package/src/store/locales/fr.js +442 -516
  52. package/src/store/locales/it.js +442 -514
  53. package/src/store/locales/kr.js +442 -491
  54. package/src/store/locales/lang.js +43 -43
  55. package/src/store/locales/sr.js +439 -492
  56. package/src/store/locales/tr.js +436 -487
  57. package/src/store/store.js +6 -6
  58. package/src/views/Account.vue +169 -207
  59. package/src/views/Callback.vue +36 -33
  60. package/src/views/Login.vue +220 -392
  61. package/src/views/MFA.vue +89 -103
  62. package/src/views/QR.vue +25 -28
  63. package/src/views/Register.vue +201 -205
  64. package/src/views/Reset.vue +132 -135
  65. package/src/views/Verify.vue +153 -151
  66. package/src/views/Welcome.vue +61 -60
  67. /package/dist/{web-L3jORB19.js → web-AXRKjAOB.js} +0 -0
  68. /package/dist/{web-5VtGcKeU.js → web-IFGkBi0t.js} +0 -0
  69. /package/dist/{web-AImUTDQQ.js → web-LIfHmYL2.js} +0 -0
@@ -1,111 +1,109 @@
1
- import {Capacitor} from '@capacitor/core';
2
- import { EventBus } from "../store/event-bus";
1
+ import { Capacitor } from '@capacitor/core';
2
+ import { EventBus } from '../store/event-bus';
3
3
  export default {
4
- computed: {
5
- home() {
6
- if (this.$storex && this.$storex.token && this.$storex.username) {
7
- if (import.meta.env.VITE_APP_MODE === 'npm') return '/' + this.$storex.username
8
- if (import.meta.env.VITE_APP_MODE === 'redirect') return '/account'
9
- } else return '/welcome'
10
- },
11
- isAndroid(){
12
- return /Android/i.test(navigator.userAgent) || Capacitor.getPlatform() === 'android'
13
- },
14
- isiOS() {
15
- return [
16
- 'iPad Simulator',
17
- 'iPhone Simulator',
18
- 'iPod Simulator',
19
- 'iPad',
20
- 'iPhone',
21
- 'iPod'
22
- ].includes(navigator.platform)
23
- // iPad on iOisNativeS 13 detection
24
- || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
25
- || Capacitor.getPlatform() === 'ios'
26
- },
27
- isNative() {
28
- return Capacitor.isNativePlatform()
29
- },
30
- },
31
- methods: {
32
- errorHandler(error) {
33
- if (error && error.response && error.response.data && error.response.data.error) {
34
- if (
35
- error.response.data.error === 'ACCESS_DENIED' ||
36
- error.response.data.error === 'TOKEN_EXPIRED'
37
- ) {
38
- this.logout();
39
- }
4
+ computed: {
5
+ home() {
6
+ if (this.$storex && this.$storex.token && this.$storex.username) {
7
+ if (import.meta.env.VITE_APP_MODE === 'npm') return '/' + this.$storex.username;
8
+ if (import.meta.env.VITE_APP_MODE === 'redirect') return '/account';
9
+ } else return '/welcome';
10
+ },
11
+ isAndroid() {
12
+ return /Android/i.test(navigator.userAgent) || Capacitor.getPlatform() === 'android';
13
+ },
14
+ isiOS() {
15
+ return (
16
+ ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) ||
17
+ // iPad on iOisNativeS 13 detection
18
+ (navigator.userAgent.includes('Mac') && 'ontouchend' in document) ||
19
+ Capacitor.getPlatform() === 'ios'
20
+ );
21
+ },
22
+ isNative() {
23
+ return Capacitor.isNativePlatform();
24
+ }
25
+ },
26
+ methods: {
27
+ errorHandler(error) {
28
+ if (error && error.response && error.response.data && error.response.data.error) {
29
+ if (error.response.data.error === 'ACCESS_DENIED' || error.response.data.error === 'TOKEN_EXPIRED') {
30
+ this.logout();
31
+ }
40
32
 
41
- // Link click network error bug fix
42
- if (!error.response.data.error.includes('Network Error') && !error.response.data.error.includes('Cannot read properties')) {
43
- this.errorSnack(error.response.data.error)
44
- }
45
- }
46
- return error
47
- },
48
- errorSnack(message) {
49
- let snackbar = document.getElementById('snackbar')
50
- let errMessage = document.getElementById('errorMessage')
51
- let errorSnack = document.getElementById('errorSnack')
52
- errMessage.innerHTML = message
53
- snackbar.classList.add('show-snack')
54
- errorSnack.classList.add('active-snack')
55
- setTimeout(function () { errorSnack.classList.remove('active-snack'); snackbar.classList.remove('show-snack') }, 3000)
56
- },
57
- successSnack(message) {
58
- let snackbar = document.getElementById('snackbar')
59
- let successMessage = document.getElementById('successMessage')
60
- let successSnack = document.getElementById('successSnack')
61
- successMessage.innerHTML = message
62
- snackbar.classList.add('show-snack')
63
- successSnack.classList.add('active-snack')
64
- setTimeout(function () { successSnack.classList.remove('active-snack'); snackbar.classList.remove('show-snack') }, 3000)
65
- },
66
- closeSnacks() {
67
- document.getElementById('snackbar').classList.remove('show-snack')
68
- document.getElementById('successSnack').classList.remove('active-snack')
69
- document.getElementById('errorSnack').classList.remove('active-snack')
70
- },
71
- tapsEmoji(count) {
72
- if (count < 10) return ''
73
- else if (count <= 50) return '🔥'
74
- else if (count <= 100) return '💥'
75
- else if (count <= 300) return '💎'
76
- else if (count > 300) return '🚀'
77
- return ''
78
- },
79
- /** Function which checks if provided object is empty */
80
- isEmpty(obj) {
81
- if (!obj) return true
82
- for (let prop in obj) {
83
- if (obj.hasOwnProperty(prop)) {
84
- return false
85
- }
86
- }
87
- return JSON.stringify(obj) === JSON.stringify({})
88
- },
89
- /** Copy string to clipboard */
90
- copy(str = '') {
91
- const el = document.createElement('textarea')
92
- el.value = str
93
- el.setAttribute('readonly', '')
94
- el.style.position = 'absolute'
95
- el.style.left = '-9999px'
96
- document.body.appendChild(el)
97
- el.select()
98
- document.execCommand('copy')
99
- document.body.removeChild(el)
100
- this.successSnack(this.ssoLang[this.appLanguage].copied)
101
- },
102
- async getCaptchaToken(action){
103
- try {
104
- return await window.grecaptcha.execute(import.meta.env.VITE_APP_GOOGLE_RECAPTCHA_SITE_KEY, {action: action});
105
- } catch (err){
106
- console.log(err)
107
- return null
108
- }
109
- },
110
- }
111
- }
33
+ // Link click network error bug fix
34
+ if (!error.response.data.error.includes('Network Error') && !error.response.data.error.includes('Cannot read properties')) {
35
+ this.errorSnack(error.response.data.error);
36
+ }
37
+ }
38
+ return error;
39
+ },
40
+ errorSnack(message) {
41
+ let snackbar = document.getElementById('snackbar');
42
+ let errMessage = document.getElementById('errorMessage');
43
+ let errorSnack = document.getElementById('errorSnack');
44
+ errMessage.innerHTML = message;
45
+ snackbar.classList.add('show-snack');
46
+ errorSnack.classList.add('active-snack');
47
+ setTimeout(function () {
48
+ errorSnack.classList.remove('active-snack');
49
+ snackbar.classList.remove('show-snack');
50
+ }, 3000);
51
+ },
52
+ successSnack(message) {
53
+ let snackbar = document.getElementById('snackbar');
54
+ let successMessage = document.getElementById('successMessage');
55
+ let successSnack = document.getElementById('successSnack');
56
+ successMessage.innerHTML = message;
57
+ snackbar.classList.add('show-snack');
58
+ successSnack.classList.add('active-snack');
59
+ setTimeout(function () {
60
+ successSnack.classList.remove('active-snack');
61
+ snackbar.classList.remove('show-snack');
62
+ }, 3000);
63
+ },
64
+ closeSnacks() {
65
+ document.getElementById('snackbar').classList.remove('show-snack');
66
+ document.getElementById('successSnack').classList.remove('active-snack');
67
+ document.getElementById('errorSnack').classList.remove('active-snack');
68
+ },
69
+ tapsEmoji(count) {
70
+ if (count < 10) return '';
71
+ else if (count <= 50) return '🔥';
72
+ else if (count <= 100) return '💥';
73
+ else if (count <= 300) return '💎';
74
+ else if (count > 300) return '🚀';
75
+ return '';
76
+ },
77
+ /** Function which checks if provided object is empty */
78
+ isEmpty(obj) {
79
+ if (!obj) return true;
80
+ for (let prop in obj) {
81
+ if (obj.hasOwnProperty(prop)) {
82
+ return false;
83
+ }
84
+ }
85
+ return JSON.stringify(obj) === JSON.stringify({});
86
+ },
87
+ /** Copy string to clipboard */
88
+ copy(str = '') {
89
+ const el = document.createElement('textarea');
90
+ el.value = str;
91
+ el.setAttribute('readonly', '');
92
+ el.style.position = 'absolute';
93
+ el.style.left = '-9999px';
94
+ document.body.appendChild(el);
95
+ el.select();
96
+ document.execCommand('copy');
97
+ document.body.removeChild(el);
98
+ this.successSnack(this.ssoLang[this.appLanguage].copied);
99
+ },
100
+ async getCaptchaToken(action) {
101
+ try {
102
+ return await window.grecaptcha.execute(import.meta.env.VITE_APP_GOOGLE_RECAPTCHA_SITE_KEY, { action: action });
103
+ } catch (err) {
104
+ console.log(err);
105
+ return null;
106
+ }
107
+ }
108
+ }
109
+ };
@@ -1,60 +1,59 @@
1
- import to from 'await-to-js'
2
- import AuthService from '../services/AuthService'
3
- import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth'
4
- import {EventBus} from "../store/event-bus";
1
+ import to from 'await-to-js';
2
+ import AuthService from '../services/AuthService';
3
+ import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';
4
+ import { EventBus } from '../store/event-bus';
5
5
 
6
6
  export default {
7
- data () {
8
- return {
9
- googleLoad: false
10
- }
11
- },
12
- computed: {
13
- displayGoogleLogin () {
14
- return true;
15
- }
16
- },
17
- mounted () {
18
- GoogleAuth.initialize()
19
- },
20
- methods: {
21
- async googleLogin () {
7
+ data() {
8
+ return {
9
+ googleLoad: false
10
+ };
11
+ },
12
+ computed: {
13
+ displayGoogleLogin() {
14
+ return true;
15
+ }
16
+ },
17
+ mounted() {
18
+ GoogleAuth.initialize();
19
+ },
20
+ methods: {
21
+ async googleLogin() {
22
+ this.googleLoad = true;
23
+ let [errAuth, user] = await to(GoogleAuth.signIn());
24
+ if (errAuth) return (this.googleLoad = false);
22
25
 
23
- this.googleLoad = true
24
- let [errAuth, user] = await to(GoogleAuth.signIn())
25
- if (errAuth) return this.googleLoad = false
26
+ // Track Referrals
27
+ if (this.referral) user.ref = this.referral;
26
28
 
27
- // Track Referrals
28
- if (this.referral) user.ref = this.referral;
29
+ if (user.authentication && (user.authentication.accessToken || user.authentication.idToken)) {
30
+ // Track Referrals
31
+ if (this.referral) user.ref = this.referral;
29
32
 
30
- if (user.authentication && (user.authentication.accessToken || user.authentication.idToken)) {
31
- // Track Referrals
32
- if (this.referral) user.ref = this.referral;
33
+ // Code Login
34
+ if (this.display === 'popup') user.response_type = 'code';
33
35
 
34
- // Code Login
35
- if (this.display === 'popup') user.response_type = 'code';
36
-
37
- const [err, response] = await to(AuthService.googleSDK(user, this.$storex))
38
- if (err) {
39
- this.googleLoad = false
40
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
41
- return this.errorHandler(err)
42
- }
43
- if (response.data.success) {
44
- if (this.display === 'popup') {
45
- return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
46
- }
47
- await this.loginSetup(response)
48
- await this.getLoggedInAccounts()
49
- this.loginSuccess({ ...response, isModal: this.isModal });
50
- setTimeout(() => {
51
- this.googleLoad = false
52
- }, 1000)
53
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err)
54
- } else {
55
- this.googleLoad = false
56
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
57
- }
58
- }
59
- }
60
- }
36
+ const [err, response] = await to(AuthService.googleSDK(user, this.$storex));
37
+ if (err) {
38
+ this.googleLoad = false;
39
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
40
+ return this.errorHandler(err);
41
+ }
42
+ if (response.data.success) {
43
+ if (this.display === 'popup') {
44
+ return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
45
+ }
46
+ await this.loginSetup(response);
47
+ await this.getLoggedInAccounts();
48
+ this.loginSuccess({ ...response, isModal: this.isModal });
49
+ setTimeout(() => {
50
+ this.googleLoad = false;
51
+ }, 1000);
52
+ } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
53
+ } else {
54
+ this.googleLoad = false;
55
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
56
+ }
57
+ }
58
+ }
59
+ };
@@ -1,76 +1,76 @@
1
- import QRCodeStyling from "qr-code-styling";
2
- import { authenticator } from "@otplib/preset-browser";
3
- import {EventBus} from "@/store/event-bus.js";
1
+ import QRCodeStyling from 'qr-code-styling';
2
+ import { authenticator } from '@otplib/preset-browser';
3
+ import { EventBus } from '@/store/event-bus.js';
4
4
 
5
5
  export default {
6
- data () {
7
- return {
8
- otpToken: null,
9
- otpSecret: null,
10
- mfaEnable: false,
11
- qrCodeHash: null,
12
- qrCodeRefreshInterval: null,
13
- poolingInterval: null,
14
- loading: false,
15
- }
16
- },
17
- props: {
18
- isModal: {
19
- type: Boolean,
20
- required: false,
21
- default: false,
22
- },
23
- },
24
- computed: {
25
- promptMFA () {
26
- return false;
27
- }
28
- },
29
- async mounted () {
30
- if (this.renderView === 'AuthMFA') {
31
- await this.getAccountSettings();
32
- this.generateOTPQrCode();
33
- }
6
+ data() {
7
+ return {
8
+ otpToken: null,
9
+ otpSecret: null,
10
+ mfaEnable: false,
11
+ qrCodeHash: null,
12
+ qrCodeRefreshInterval: null,
13
+ poolingInterval: null,
14
+ loading: false
15
+ };
16
+ },
17
+ props: {
18
+ isModal: {
19
+ type: Boolean,
20
+ required: false,
21
+ default: false
22
+ }
23
+ },
24
+ computed: {
25
+ promptMFA() {
26
+ return false;
27
+ }
28
+ },
29
+ async mounted() {
30
+ if (this.renderView === 'AuthMFA') {
31
+ await this.getAccountSettings();
32
+ this.generateOTPQrCode();
33
+ }
34
34
 
35
- EventBus.$on('otpSubmitted', this.otpSubmitted)
36
- },
37
- methods: {
38
- otpSubmitted(code) {
39
- this.otpToken = code;
35
+ EventBus.$on('otpSubmitted', this.otpSubmitted);
36
+ },
37
+ methods: {
38
+ otpSubmitted(code) {
39
+ this.otpToken = code;
40
40
 
41
- // Assuming that the parent component had a method called submit
42
- this.submit();
43
- },
44
- generateOTPQrCode() {
45
- const user = this.account.email;
41
+ // Assuming that the parent component had a method called submit
42
+ this.submit();
43
+ },
44
+ generateOTPQrCode() {
45
+ const user = this.account.email;
46
46
 
47
- if (this.account.mfaEnabled) {
48
- this.mfaEnable = true;
49
- } else {
50
- const service = "Tapni";
47
+ if (this.account.mfaEnabled) {
48
+ this.mfaEnable = true;
49
+ } else {
50
+ const service = 'Tapni';
51
51
 
52
- const secret = authenticator.generateSecret();
53
- this.otpSecret = secret;
52
+ const secret = authenticator.generateSecret();
53
+ this.otpSecret = secret;
54
54
 
55
- const otpQR = authenticator.keyuri(user, service, secret);
55
+ const otpQR = authenticator.keyuri(user, service, secret);
56
56
 
57
- const otpQrCode = new QRCodeStyling({
58
- width: 200,
59
- height: 200,
60
- data: otpQR,
61
- });
62
- otpQrCode.append(document.getElementById("qrCodeContainer"));
63
- }
64
- },
65
- async cancelMFA() {
66
- if (import.meta.env.VITE_APP_MODE === 'npm') {
67
- EventBus.$emit('ssoEvent', {name: 'mfaCancel', data: true})
68
- } else {
69
- this.$router.push('/account');
70
- }
71
- },
72
- async validateMFA() {
73
- EventBus.$emit('toggleOTPModal', true);
74
- },
75
- }
76
- }
57
+ const otpQrCode = new QRCodeStyling({
58
+ width: 200,
59
+ height: 200,
60
+ data: otpQR
61
+ });
62
+ otpQrCode.append(document.getElementById('qrCodeContainer'));
63
+ }
64
+ },
65
+ async cancelMFA() {
66
+ if (import.meta.env.VITE_APP_MODE === 'npm') {
67
+ EventBus.$emit('ssoEvent', { name: 'mfaCancel', data: true });
68
+ } else {
69
+ this.$router.push('/account');
70
+ }
71
+ },
72
+ async validateMFA() {
73
+ EventBus.$emit('toggleOTPModal', true);
74
+ }
75
+ }
76
+ };
@@ -1,82 +1,74 @@
1
- import to from "await-to-js";
2
- import AuthService from "../services/AuthService";
3
- import { MsAuthPlugin } from "@recognizebv/capacitor-plugin-msauth";
4
- import { EventBus } from "../store/event-bus";
1
+ import to from 'await-to-js';
2
+ import AuthService from '../services/AuthService';
3
+ import { MsAuthPlugin } from '@recognizebv/capacitor-plugin-msauth';
4
+ import { EventBus } from '../store/event-bus';
5
5
 
6
6
  export default {
7
- data() {
8
- return {
9
- microsoftLoad: false,
10
- microsoftSSOLoad: false,
11
- };
12
- },
13
- computed: {
14
- displayMicrosoftSSOLogin() {
15
- return false;
16
- },
17
- },
18
- methods: {
19
- async microsoftLogin(type, sso = {}) {
20
- if (type === "sso") this.microsoftSSOLoad = true;
21
- else this.microsoftLoad = true;
7
+ data() {
8
+ return {
9
+ microsoftLoad: false,
10
+ microsoftSSOLoad: false
11
+ };
12
+ },
13
+ computed: {
14
+ displayMicrosoftSSOLogin() {
15
+ return false;
16
+ }
17
+ },
18
+ methods: {
19
+ async microsoftLogin(type, sso = {}) {
20
+ if (type === 'sso') this.microsoftSSOLoad = true;
21
+ else this.microsoftLoad = true;
22
22
 
23
- const [errAuth, user] = await to(
24
- MsAuthPlugin.login({
25
- clientId: type === "sso" ? sso.clientID : import.meta.env.VITE_APP_SSO_ID,
26
- tenant: type === "sso" ? sso.tenant : "consumers",
27
- scopes: ["User.Read"],
28
- knownAuthorities: [],
29
- keyHash: "4+5wCp8QcLptlO0aeP5RDTTOWyg=", // Android,
30
- redirectUri:
31
- import.meta.env.DEV
32
- ? `${window.location.origin}/login`
33
- : "https://" + window.location.host + "/login",
34
- })
35
- );
36
- if (errAuth) {
37
- console.log("Error: " + JSON.stringify(errAuth));
38
- return (this.microsoftLoad = false);
39
- }
23
+ const [errAuth, user] = await to(
24
+ MsAuthPlugin.login({
25
+ clientId: type === 'sso' ? sso.clientID : import.meta.env.VITE_APP_SSO_ID,
26
+ tenant: type === 'sso' ? sso.tenant : 'consumers',
27
+ scopes: ['User.Read'],
28
+ knownAuthorities: [],
29
+ keyHash: '4+5wCp8QcLptlO0aeP5RDTTOWyg=', // Android,
30
+ redirectUri: import.meta.env.DEV ? `${window.location.origin}/login` : 'https://' + window.location.host + '/login'
31
+ })
32
+ );
33
+ if (errAuth) {
34
+ console.log('Error: ' + JSON.stringify(errAuth));
35
+ return (this.microsoftLoad = false);
36
+ }
40
37
 
41
- // Track Referrals
42
- if (this.referral) user.ref = this.referral;
38
+ // Track Referrals
39
+ if (this.referral) user.ref = this.referral;
43
40
 
44
- // Code Login
45
- if (this.display === "popup") user.response_type = "code";
41
+ // Code Login
42
+ if (this.display === 'popup') user.response_type = 'code';
46
43
 
47
- if (user && (user.accessToken || user.idToken)) {
48
- const [err, response] = await to(
49
- AuthService.microsoftSDK(user, this.$storex)
50
- );
51
- if (err) {
52
- this.microsoftLoad = false;
53
- this.microsoftSSOLoad = false;
54
- EventBus.$emit("ssoEvent", { name: "setLoading", data: false });
55
- return this.errorHandler(err);
56
- }
57
- if (response.data.success) {
58
- if (this.display === "popup") {
59
- return window.parent?.postMessage(
60
- { code: response.data.auth_code, state: this.$route.query.state },
61
- "*"
62
- );
63
- }
64
- await this.loginSetup(response);
65
- await this.getLoggedInAccounts();
66
- this.loginSuccess({ ...response, isModal: this.isModal });
67
- setTimeout(() => {
68
- this.microsoftLoad = false;
69
- this.microsoftSSOLoad = false;
70
- }, 1000);
71
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
72
- } else {
73
- this.microsoftLoad = false;
74
- this.microsoftSSOLoad = false;
75
- EventBus.$emit("ssoEvent", { name: "setLoading", data: false });
76
- }
77
- },
78
- ssoLogin() {
79
- EventBus.$emit("toggleSSOModal");
80
- },
81
- },
44
+ if (user && (user.accessToken || user.idToken)) {
45
+ const [err, response] = await to(AuthService.microsoftSDK(user, this.$storex));
46
+ if (err) {
47
+ this.microsoftLoad = false;
48
+ this.microsoftSSOLoad = false;
49
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
50
+ return this.errorHandler(err);
51
+ }
52
+ if (response.data.success) {
53
+ if (this.display === 'popup') {
54
+ return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
55
+ }
56
+ await this.loginSetup(response);
57
+ await this.getLoggedInAccounts();
58
+ this.loginSuccess({ ...response, isModal: this.isModal });
59
+ setTimeout(() => {
60
+ this.microsoftLoad = false;
61
+ this.microsoftSSOLoad = false;
62
+ }, 1000);
63
+ } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
64
+ } else {
65
+ this.microsoftLoad = false;
66
+ this.microsoftSSOLoad = false;
67
+ EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
68
+ }
69
+ },
70
+ ssoLogin() {
71
+ EventBus.$emit('toggleSSOModal');
72
+ }
73
+ }
82
74
  };