@tapni/auth 1.0.8 → 1.0.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/README.md +2 -0
- package/dist/.vite/manifest.json +12 -12
- package/dist/.well-known/assetlinks.json +10 -12
- package/dist/.well-known/microsoft-identity-association.json +5 -5
- package/dist/{Apps-aanvwc1E.js → Apps-spt3-xmr.js} +1 -1
- package/dist/{Billing-C7LjeXBV.js → Billing-EQtSRyls.js} +1 -1
- package/dist/{CustomApp-Cd00FwXJ.js → CustomApp-DytcodWc.js} +1 -1
- package/dist/{General-DH-AnLIA.js → General-BBoC_TV2.js} +1 -1
- package/dist/{QR-cfWsMTIZ.js → QR-DmSyXgb5.js} +1 -1
- package/dist/TapniAuth.es.js +1 -1
- package/dist/TapniAuth.umd.js +8 -8
- package/dist/blank.html +31 -0
- package/dist/{install-CBFqB-tX.js → install-DJ7V1wyP.js} +761 -744
- package/dist/site.webmanifest +11 -1
- package/dist/style.css +1 -1
- package/package.json +14 -4
- package/src/.prettierrc.json +16 -0
- package/src/components/DELETE_LinkIcon.vue +174 -225
- package/src/components/DELETE_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 +3 -2
- package/src/mixins/global.mixin.js +2 -2
- package/src/mixins/google.mixin.js +53 -54
- package/src/mixins/qr-auth.mixin.js +111 -107
- package/src/router/index.js +6 -6
- package/src/routes.js +1 -1
- package/src/services/Api.js +55 -57
- 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/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/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 +2 -2
- package/src/views/Callback.vue +36 -33
- package/src/views/Login.vue +3 -3
- package/src/views/Reset.vue +132 -135
- package/src/views/Verify.vue +153 -151
|
@@ -1,166 +1,111 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
style="margin-top: 5px; position: absolute; right: 5px"
|
|
12
|
-
>
|
|
13
|
-
<i class="font-17 color-black">
|
|
14
|
-
<img
|
|
15
|
-
src="https://cdn.tapni.co/icons/down-arrow.png"
|
|
16
|
-
class="responsive-image"
|
|
17
|
-
style="width: 45%"
|
|
18
|
-
/>
|
|
19
|
-
</i>
|
|
20
|
-
</a>
|
|
21
|
-
<h3 class="bold center-text color-black half-top half-bottom">
|
|
22
|
-
{{ ssoLang[appLanguage].select_sign_method }}
|
|
23
|
-
</h3>
|
|
2
|
+
<form @submit.prevent class="menu-wrapper menu-light menu-modal center-text activate-page" :class="{ 'active-menu': toggle }" style="height: auto; margin-top: -172.5px">
|
|
3
|
+
<a @click="forceClose" class="color-black pull-right pointer" style="margin-top: 5px; position: absolute; right: 5px">
|
|
4
|
+
<i class="font-17 color-black">
|
|
5
|
+
<img src="https://cdn.tapni.co/icons/down-arrow.png" class="responsive-image" style="width: 45%" />
|
|
6
|
+
</i>
|
|
7
|
+
</a>
|
|
8
|
+
<h3 class="bold center-text color-black half-top half-bottom">
|
|
9
|
+
{{ ssoLang[appLanguage].select_sign_method }}
|
|
10
|
+
</h3>
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<img
|
|
32
|
-
src="https://cdn.tapni.co/icons/azure.png"
|
|
33
|
-
style="
|
|
34
|
-
position: absolute;
|
|
35
|
-
margin-left: -11px;
|
|
36
|
-
padding: 8px 0;
|
|
37
|
-
height: 100%;
|
|
38
|
-
"
|
|
39
|
-
/>
|
|
40
|
-
<span v-if="!azureLoad"
|
|
41
|
-
>{{ ssoLang[appLanguage].sign_in_with }} Azure</span
|
|
42
|
-
>
|
|
43
|
-
<span v-else class="button--loading button__loader"></span>
|
|
44
|
-
</a>
|
|
12
|
+
<!-- Azure Login Button -->
|
|
13
|
+
<a v-if="sso?.azure" @click="ssoLogin('azure')" class="button-center button black-button button-90 google-button pointer">
|
|
14
|
+
<img src="https://cdn.tapni.co/icons/azure.png" style="position: absolute; margin-left: -11px; padding: 8px 0; height: 100%" />
|
|
15
|
+
<span v-if="!azureLoad">{{ ssoLang[appLanguage].sign_in_with }} Azure</span>
|
|
16
|
+
<span v-else class="button--loading button__loader"></span>
|
|
17
|
+
</a>
|
|
45
18
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<img
|
|
53
|
-
src="https://cdn.tapni.co/icons/okta.png"
|
|
54
|
-
style="
|
|
55
|
-
position: absolute;
|
|
56
|
-
margin-left: -11px;
|
|
57
|
-
padding: 8px 0;
|
|
58
|
-
height: 100%;
|
|
59
|
-
"
|
|
60
|
-
/>
|
|
61
|
-
<span v-if="!oktaLoad"
|
|
62
|
-
>{{ ssoLang[appLanguage].sign_in_with }} Okta</span
|
|
63
|
-
>
|
|
64
|
-
<span v-else class="button--loading button__loader"></span>
|
|
65
|
-
</a>
|
|
19
|
+
<!-- Okta Login Button -->
|
|
20
|
+
<a v-if="sso?.okta" @click="ssoLogin('okta')" class="button-center button black-button button-90 google-button pointer">
|
|
21
|
+
<img src="https://cdn.tapni.co/icons/okta.png" style="position: absolute; margin-left: -11px; padding: 8px 0; height: 100%" />
|
|
22
|
+
<span v-if="!oktaLoad">{{ ssoLang[appLanguage].sign_in_with }} Okta</span>
|
|
23
|
+
<span v-else class="button--loading button__loader"></span>
|
|
24
|
+
</a>
|
|
66
25
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
src="https://cdn.tapni.co/icons/saml.png"
|
|
75
|
-
style="
|
|
76
|
-
position: absolute;
|
|
77
|
-
margin-left: -11px;
|
|
78
|
-
padding: 8px 0;
|
|
79
|
-
height: 100%;
|
|
80
|
-
"
|
|
81
|
-
/>
|
|
82
|
-
<span v-if="!samlLoad"
|
|
83
|
-
>{{ ssoLang[appLanguage].sign_in_with }} SAML</span
|
|
84
|
-
>
|
|
85
|
-
<span v-else class="button--loading button__loader"></span>
|
|
86
|
-
</a>
|
|
87
|
-
</form>
|
|
26
|
+
<!-- SAML Login Button -->
|
|
27
|
+
<a v-if="sso?.saml" @click="ssoLogin('saml')" class="button-center button black-button button-90 google-button pointer">
|
|
28
|
+
<img src="https://cdn.tapni.co/icons/saml.png" style="position: absolute; margin-left: -11px; padding: 8px 0; height: 100%" />
|
|
29
|
+
<span v-if="!samlLoad">{{ ssoLang[appLanguage].sign_in_with }} SAML</span>
|
|
30
|
+
<span v-else class="button--loading button__loader"></span>
|
|
31
|
+
</a>
|
|
32
|
+
</form>
|
|
88
33
|
</template>
|
|
89
34
|
|
|
90
35
|
<script>
|
|
91
|
-
import { EventBus } from
|
|
92
|
-
import MicrosoftMixin from
|
|
93
|
-
import OktaMixin from
|
|
94
|
-
import SamlMixin from
|
|
95
|
-
import AuthMixin from
|
|
36
|
+
import { EventBus } from '../store/event-bus';
|
|
37
|
+
import MicrosoftMixin from '../mixins/microsoft.mixin';
|
|
38
|
+
import OktaMixin from '../mixins/okta.mixin';
|
|
39
|
+
import SamlMixin from '../mixins/saml.mixin';
|
|
40
|
+
import AuthMixin from '../mixins/auth.mixin';
|
|
96
41
|
export default {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
42
|
+
name: 'SSOPick',
|
|
43
|
+
mixins: [MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin],
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
toggle: false,
|
|
47
|
+
sso: null,
|
|
48
|
+
email: null,
|
|
49
|
+
azureLoad: false,
|
|
50
|
+
oktaLoad: false,
|
|
51
|
+
samlLoad: false
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
mounted() {
|
|
55
|
+
EventBus.$on('toggleSSOPickModal', this.toggleModal);
|
|
56
|
+
EventBus.$on('closeModal', () => {
|
|
57
|
+
this.toggle = false;
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
beforeDestroy() {
|
|
61
|
+
EventBus['_events']['toggleSSOPickModal'].pop();
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
forceClose() {
|
|
65
|
+
EventBus.$emit('closeModal');
|
|
66
|
+
},
|
|
67
|
+
close() {
|
|
68
|
+
this.toggleModal();
|
|
69
|
+
},
|
|
70
|
+
async ssoLogin(type) {
|
|
71
|
+
if (type === 'azure') {
|
|
72
|
+
this.microsoftLogin('sso', this.sso.azure.sso);
|
|
73
|
+
this.azureLoad = true;
|
|
74
|
+
}
|
|
75
|
+
if (type === 'okta') {
|
|
76
|
+
this.oktaLogin(this.sso.okta.sso);
|
|
77
|
+
this.oktaLoad = true;
|
|
78
|
+
}
|
|
79
|
+
if (type === 'saml') {
|
|
80
|
+
this.samlLogin(this.sso.saml.sso.loginUrl);
|
|
81
|
+
this.samlLoad = true;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
toggleModal(data) {
|
|
85
|
+
this.azureLoad = false;
|
|
86
|
+
this.oktaLoad = false;
|
|
87
|
+
this.samlLoad = false;
|
|
88
|
+
this.sso = null;
|
|
89
|
+
this.email = null;
|
|
145
90
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
91
|
+
if (data) {
|
|
92
|
+
this.sso = data.sso;
|
|
93
|
+
this.email = data.email;
|
|
94
|
+
}
|
|
95
|
+
this.toggle = !this.toggle;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
153
98
|
};
|
|
154
99
|
</script>
|
|
155
100
|
|
|
156
101
|
<style scoped>
|
|
157
102
|
.sso-img {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
103
|
+
margin: 0 auto;
|
|
104
|
+
margin-top: 2px;
|
|
105
|
+
width: 35px;
|
|
161
106
|
}
|
|
162
107
|
input {
|
|
163
|
-
|
|
164
|
-
|
|
108
|
+
margin: 0 auto;
|
|
109
|
+
height: 25px;
|
|
165
110
|
}
|
|
166
111
|
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import pluginVue from 'eslint-plugin-vue';
|
|
2
|
+
export default [
|
|
3
|
+
...pluginVue.configs['flat/recommended'],
|
|
4
|
+
{
|
|
5
|
+
rules: {
|
|
6
|
+
'vue/require-valid-default-prop': 'off',
|
|
7
|
+
'vue/max-attributes-per-line': 'off',
|
|
8
|
+
'vue/html-indent': 'off',
|
|
9
|
+
'vue/html-self-closing': 'off',
|
|
10
|
+
'vue/singleline-html-element-content-newline': 'off'
|
|
11
|
+
// override/add rules settings here, such as:
|
|
12
|
+
// 'vue/no-unused-vars': 'error'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
];
|
package/src/install.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from './App.vue';
|
|
2
2
|
import auth from './store/auth.js';
|
|
3
3
|
|
|
4
4
|
// Export the component by default
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
install: (app, { store, apiRoot }) => {
|
|
7
|
+
// Register the component
|
|
8
|
+
app.component('TapniAuth', App);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (!store.hasModule('auth')) {
|
|
11
|
+
store.registerModule('auth', auth);
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
14
|
+
app.config.globalProperties.$apiRoot = apiRoot;
|
|
15
|
+
}
|
|
17
16
|
};
|
package/src/main.js
CHANGED
|
@@ -1,76 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createApp } from 'vue'
|
|
3
|
-
import RootApp from './App.vue'
|
|
4
|
-
import router from './router'
|
|
5
|
-
import VueCookies from 'vue-cookies'
|
|
1
|
+
import '@tapni/styles/dist/index.css';
|
|
2
|
+
import { createApp } from 'vue';
|
|
3
|
+
import RootApp from './App.vue';
|
|
4
|
+
import router from './router';
|
|
5
|
+
import VueCookies from 'vue-cookies';
|
|
6
6
|
import { App } from '@capacitor/app';
|
|
7
7
|
import { Browser } from '@capacitor/browser';
|
|
8
8
|
import store from './store/store.js';
|
|
9
9
|
import { sync } from 'vuex-router-sync';
|
|
10
10
|
|
|
11
|
-
const app = createApp(RootApp)
|
|
11
|
+
const app = createApp(RootApp);
|
|
12
12
|
|
|
13
|
-
app.config.productionTip = false
|
|
13
|
+
app.config.productionTip = false;
|
|
14
14
|
|
|
15
15
|
// Vuex Router Sync
|
|
16
16
|
sync(store, router);
|
|
17
17
|
|
|
18
18
|
// Cookies
|
|
19
|
-
app.use(VueCookies)
|
|
19
|
+
app.use(VueCookies);
|
|
20
20
|
|
|
21
|
-
app.use(router)
|
|
21
|
+
app.use(router);
|
|
22
22
|
|
|
23
|
-
app.use(store)
|
|
24
|
-
|
|
25
|
-
app.mount('#app')
|
|
23
|
+
app.use(store);
|
|
26
24
|
|
|
25
|
+
app.mount('#app');
|
|
27
26
|
|
|
28
27
|
function hasQueryParams(route) {
|
|
29
|
-
|
|
28
|
+
return !!Object.keys(route.query).length;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
router.beforeEach((to, from, next) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
window.scrollTo(0, 0);
|
|
34
|
+
}, 100);
|
|
35
|
+
|
|
36
|
+
if (!hasQueryParams(to) && hasQueryParams(from)) {
|
|
37
|
+
next({ name: to.name, query: from.query });
|
|
38
|
+
} else {
|
|
39
|
+
next();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* Redirect users to desired profile - DEEP LINKING
|
|
46
45
|
* @param data
|
|
47
46
|
*/
|
|
48
47
|
function redirectToProfile(data) {
|
|
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
|
-
|
|
48
|
+
if (data && data.url) {
|
|
49
|
+
let url = new URL(data.url);
|
|
50
|
+
let pathname = url.pathname || '';
|
|
51
|
+
let queryParams = url.search || '';
|
|
52
|
+
if (queryParams) queryParams = Object.fromEntries(new URLSearchParams(queryParams));
|
|
53
|
+
else queryParams = {};
|
|
54
|
+
let subdomain = '';
|
|
55
|
+
//['my', 'tapni', 'co']
|
|
56
|
+
let tempArr = url.hostname.split('.');
|
|
57
|
+
if (tempArr.length === 3) subdomain = tempArr[0];
|
|
58
|
+
if (subdomain) queryParams.s = subdomain;
|
|
59
|
+
|
|
60
|
+
// open t.link shorter links in browser
|
|
61
|
+
if (pathname && /[A-Z]/.test(pathname) && !pathname.startsWith('/t/')) {
|
|
62
|
+
Browser.open({ url: url.toString() });
|
|
63
|
+
return router.push('/');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (pathname) {
|
|
67
|
+
router.push({
|
|
68
|
+
path: pathname,
|
|
69
|
+
query: queryParams
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* CAPACITOR_CONFIG
|
|
@@ -78,13 +77,12 @@ function redirectToProfile(data) {
|
|
|
78
77
|
* Users who have an app should get the profiles opened in the app ie: tapni.co/tapni
|
|
79
78
|
*/
|
|
80
79
|
App.addListener('appUrlOpen', async function (data) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
80
|
+
if (data.url && data.url.startsWith('tapni://')) data.url = data.url.replace('tapni://', 'https://');
|
|
81
|
+
let url = new URL(data.url);
|
|
82
|
+
if (url.pathname.includes('/callback/')) {
|
|
83
|
+
await router.push({ path: url.pathname, query: Object.fromEntries(new URLSearchParams(url.search)) });
|
|
84
|
+
} else redirectToProfile(data);
|
|
85
|
+
});
|
|
88
86
|
|
|
89
87
|
// When the app is open and you trigger NFC event to open the app
|
|
90
88
|
// App.addListener('appStateChange', async function (l) {
|
|
@@ -93,8 +91,7 @@ App.addListener('appUrlOpen', async function (data) {
|
|
|
93
91
|
|
|
94
92
|
// When the app is closed and NFC event opens the app
|
|
95
93
|
App.getLaunchUrl().then((data) => {
|
|
96
|
-
|
|
94
|
+
redirectToProfile(data);
|
|
97
95
|
});
|
|
98
96
|
|
|
99
|
-
|
|
100
97
|
export { app };
|
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import to from 'await-to-js'
|
|
2
|
-
import AuthService from '../services/AuthService'
|
|
3
|
-
import {SignInWithApple} from '@capacitor-community/apple-sign-in';
|
|
1
|
+
import to from 'await-to-js';
|
|
2
|
+
import AuthService from '../services/AuthService';
|
|
3
|
+
import { SignInWithApple } from '@capacitor-community/apple-sign-in';
|
|
4
4
|
|
|
5
|
-
import { jwtDecode } from
|
|
6
|
-
import {EventBus} from '../store/event-bus';
|
|
5
|
+
import { jwtDecode } from 'jwt-decode';
|
|
6
|
+
import { EventBus } from '../store/event-bus';
|
|
7
7
|
export default {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
appleLoad: false
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
computed: {
|
|
14
|
+
displayAppleLogin() {
|
|
15
|
+
return (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios') || (!Capacitor.isNativePlatform() && this.isiOS);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
methods: {
|
|
19
|
+
async appleLogin() {
|
|
20
|
+
this.appleLoad = true;
|
|
21
|
+
const [errAuth, user] = await to(
|
|
22
|
+
SignInWithApple.authorize({
|
|
23
|
+
clientId: 'co.tapni.applelogin',
|
|
24
|
+
redirectURI: 'https://' + window.location.host + '/login',
|
|
25
|
+
scopes: 'email name'
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
if (errAuth) return (this.appleLoad = false);
|
|
29
|
+
user.response.tokenData = jwtDecode(user.response.identityToken);
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (user && user.response && user.response.identityToken) {
|
|
32
|
+
// Track Referrals
|
|
33
|
+
if (this.referral) user.response.ref = this.referral;
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// Code Login
|
|
36
|
+
if (this.display === 'popup') user.response_type = 'code';
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
38
|
+
const [err, response] = await to(AuthService.appleSDK(user.response, this.$storex));
|
|
39
|
+
if (err) {
|
|
40
|
+
this.appleLoad = false;
|
|
41
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
42
|
+
return this.errorHandler(err);
|
|
43
|
+
}
|
|
44
|
+
if (response.data.success) {
|
|
45
|
+
if (this.display === 'popup') {
|
|
46
|
+
return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
|
|
47
|
+
}
|
|
48
|
+
await this.loginSetup(response);
|
|
49
|
+
await this.getLoggedInAccounts();
|
|
50
|
+
this.loginSuccess({ ...response, isModal: this.isModal });
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
this.appleLoad = false;
|
|
53
|
+
}, 1000);
|
|
54
|
+
} else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err);
|
|
55
|
+
} else {
|
|
56
|
+
this.appleLoad = false;
|
|
57
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
package/src/mixins/auth.mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createNamespacedHelpers } from 'vuex';
|
|
2
2
|
const { mapState, mapActions, mapGetters } = createNamespacedHelpers('auth');
|
|
3
|
-
import GlobalMixin from './global.mixin'
|
|
3
|
+
import GlobalMixin from './global.mixin';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
mixins: [GlobalMixin],
|
|
@@ -64,6 +64,7 @@ export default {
|
|
|
64
64
|
'setRedirectUri',
|
|
65
65
|
'setDisplay',
|
|
66
66
|
'setState',
|
|
67
|
+
'setRealm',
|
|
67
68
|
'setResponseType',
|
|
68
69
|
'switchAccount',
|
|
69
70
|
'loginSetup',
|
|
@@ -78,7 +79,7 @@ export default {
|
|
|
78
79
|
if (this.$route.query.display) this.setDisplay(this.$route.query.display);
|
|
79
80
|
if (this.$route.query.state) this.setState(this.$route.query.state)
|
|
80
81
|
if (this.$route.query.response_type) this.setResponseType(this.$route.query.response_type);
|
|
81
|
-
if (this.$route.query.realm
|
|
82
|
+
if (this.$route.query.realm) this.setRealm(this.$route.query.realm);
|
|
82
83
|
},
|
|
83
84
|
deep: true,
|
|
84
85
|
},
|
|
@@ -30,10 +30,10 @@ export default {
|
|
|
30
30
|
},
|
|
31
31
|
methods: {
|
|
32
32
|
getIcon(icon) {
|
|
33
|
-
if (!this.isNative
|
|
33
|
+
if (!this.isNative) {
|
|
34
34
|
return 'https://cdn.tapni.co/icons/' + icon;
|
|
35
35
|
} else {
|
|
36
|
-
return
|
|
36
|
+
return `/icons/${icon}`;
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
errorHandler(error) {
|