@tapni/auth 0.0.170 → 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.
- package/README.md +2 -0
- package/dist/.vite/manifest.json +18 -10
- package/dist/.well-known/assetlinks.json +10 -12
- package/dist/.well-known/microsoft-identity-association.json +5 -5
- package/dist/{Account-6F9eRo1R.js → Account-BB71UmF3.js} +31 -32
- package/dist/{QR-2Izy5Dj4.js → QR-BJnR_0ci.js} +3 -3
- package/dist/TapniAuth.es.js +1 -1
- package/dist/TapniAuth.umd.js +9 -9
- package/dist/blank.html +31 -0
- package/dist/{install-co2F1hxN.js → install-Cx9Gi17U.js} +752 -996
- package/dist/site.webmanifest +11 -1
- package/dist/style.css +1 -1
- package/dist/{web-NrPZl3qD.js → web-XbruGdlD.js} +2 -5
- package/package.json +64 -55
- package/src/.prettierrc.json +16 -0
- package/src/App.vue +249 -265
- package/src/components/Language.vue +66 -143
- package/src/components/LinkIcon.vue +174 -225
- package/src/components/ModalOverlay.vue +47 -50
- package/src/components/OTP.vue +64 -94
- package/src/components/SSO.vue +80 -111
- package/src/components/SSOPick.vue +93 -148
- package/src/eslint.config.js +15 -0
- package/src/install.js +9 -10
- package/src/main.js +54 -57
- package/src/mixins/apple.mixin.js +56 -54
- package/src/mixins/auth.mixin.js +21 -74
- package/src/mixins/facebook.mixin.js +67 -66
- package/src/mixins/global.mixin.js +107 -109
- package/src/mixins/google.mixin.js +53 -54
- package/src/mixins/mfa-auth.mixin.js +68 -68
- package/src/mixins/microsoft.mixin.js +67 -75
- package/src/mixins/okta.mixin.js +50 -57
- package/src/mixins/qr-auth.mixin.js +111 -107
- package/src/mixins/saml.mixin.js +97 -48
- package/src/router/index.js +6 -6
- package/src/routes.js +60 -66
- package/src/services/Api.js +55 -57
- package/src/services/AuthService.js +75 -75
- package/src/services/CompanyService.js +10 -10
- package/src/services/DeviceService.js +3 -3
- package/src/services/UserService.js +45 -45
- package/src/services/UtilService.js +256 -218
- package/src/store/auth.js +471 -543
- package/src/store/constants.js +1 -1
- package/src/store/event-bus.js +22 -22
- package/src/store/locales/cn.js +442 -458
- package/src/store/locales/de.js +438 -517
- package/src/store/locales/en.js +449 -510
- package/src/store/locales/es.js +442 -524
- package/src/store/locales/fr.js +442 -516
- package/src/store/locales/it.js +442 -514
- package/src/store/locales/kr.js +442 -491
- package/src/store/locales/lang.js +43 -43
- package/src/store/locales/sr.js +439 -492
- package/src/store/locales/tr.js +436 -487
- package/src/store/store.js +6 -6
- package/src/views/Account.vue +169 -207
- package/src/views/Callback.vue +36 -33
- package/src/views/Login.vue +220 -392
- package/src/views/MFA.vue +89 -103
- package/src/views/QR.vue +25 -28
- package/src/views/Register.vue +201 -205
- package/src/views/Reset.vue +132 -135
- package/src/views/Verify.vue +153 -151
- package/src/views/Welcome.vue +61 -60
- /package/dist/{web-L3jORB19.js → web-AXRKjAOB.js} +0 -0
- /package/dist/{web-5VtGcKeU.js → web-IFGkBi0t.js} +0 -0
- /package/dist/{web-AImUTDQQ.js → web-LIfHmYL2.js} +0 -0
|
@@ -1,111 +1,109 @@
|
|
|
1
|
-
import {Capacitor} from '@capacitor/core';
|
|
2
|
-
import { EventBus } from
|
|
1
|
+
import { Capacitor } from '@capacitor/core';
|
|
2
|
+
import { EventBus } from '../store/event-bus';
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
if (errAuth) return this.googleLoad = false
|
|
26
|
+
// Track Referrals
|
|
27
|
+
if (this.referral) user.ref = this.referral;
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
if (user.authentication && (user.authentication.accessToken || user.authentication.idToken)) {
|
|
30
|
+
// Track Referrals
|
|
31
|
+
if (this.referral) user.ref = this.referral;
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this.referral) user.ref = this.referral;
|
|
33
|
+
// Code Login
|
|
34
|
+
if (this.display === 'popup') user.response_type = 'code';
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
2
|
-
import { authenticator } from
|
|
3
|
-
import {EventBus} from
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
EventBus.$on('otpSubmitted', this.otpSubmitted);
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
otpSubmitted(code) {
|
|
39
|
+
this.otpToken = code;
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (this.account.mfaEnabled) {
|
|
48
|
+
this.mfaEnable = true;
|
|
49
|
+
} else {
|
|
50
|
+
const service = 'Tapni';
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const secret = authenticator.generateSecret();
|
|
53
|
+
this.otpSecret = secret;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
const otpQR = authenticator.keyuri(user, service, secret);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
2
|
-
import AuthService from
|
|
3
|
-
import { MsAuthPlugin } from
|
|
4
|
-
import { EventBus } from
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
42
|
-
|
|
38
|
+
// Track Referrals
|
|
39
|
+
if (this.referral) user.ref = this.referral;
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
// Code Login
|
|
42
|
+
if (this.display === 'popup') user.response_type = 'code';
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
};
|