@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.
Files changed (50) hide show
  1. package/README.md +2 -0
  2. package/dist/.vite/manifest.json +12 -12
  3. package/dist/.well-known/assetlinks.json +10 -12
  4. package/dist/.well-known/microsoft-identity-association.json +5 -5
  5. package/dist/{Apps-aanvwc1E.js → Apps-spt3-xmr.js} +1 -1
  6. package/dist/{Billing-C7LjeXBV.js → Billing-EQtSRyls.js} +1 -1
  7. package/dist/{CustomApp-Cd00FwXJ.js → CustomApp-DytcodWc.js} +1 -1
  8. package/dist/{General-DH-AnLIA.js → General-BBoC_TV2.js} +1 -1
  9. package/dist/{QR-cfWsMTIZ.js → QR-DmSyXgb5.js} +1 -1
  10. package/dist/TapniAuth.es.js +1 -1
  11. package/dist/TapniAuth.umd.js +8 -8
  12. package/dist/blank.html +31 -0
  13. package/dist/{install-CBFqB-tX.js → install-DJ7V1wyP.js} +761 -744
  14. package/dist/site.webmanifest +11 -1
  15. package/dist/style.css +1 -1
  16. package/package.json +14 -4
  17. package/src/.prettierrc.json +16 -0
  18. package/src/components/DELETE_LinkIcon.vue +174 -225
  19. package/src/components/DELETE_SSOPick.vue +93 -148
  20. package/src/eslint.config.js +15 -0
  21. package/src/install.js +9 -10
  22. package/src/main.js +54 -57
  23. package/src/mixins/apple.mixin.js +56 -54
  24. package/src/mixins/auth.mixin.js +3 -2
  25. package/src/mixins/global.mixin.js +2 -2
  26. package/src/mixins/google.mixin.js +53 -54
  27. package/src/mixins/qr-auth.mixin.js +111 -107
  28. package/src/router/index.js +6 -6
  29. package/src/routes.js +1 -1
  30. package/src/services/Api.js +55 -57
  31. package/src/services/CompanyService.js +10 -10
  32. package/src/services/DeviceService.js +3 -3
  33. package/src/services/UserService.js +45 -45
  34. package/src/services/UtilService.js +256 -218
  35. package/src/store/event-bus.js +22 -22
  36. package/src/store/locales/cn.js +442 -458
  37. package/src/store/locales/de.js +438 -517
  38. package/src/store/locales/es.js +442 -524
  39. package/src/store/locales/fr.js +442 -516
  40. package/src/store/locales/it.js +442 -514
  41. package/src/store/locales/kr.js +442 -491
  42. package/src/store/locales/lang.js +43 -43
  43. package/src/store/locales/sr.js +439 -492
  44. package/src/store/locales/tr.js +436 -487
  45. package/src/store/store.js +6 -6
  46. package/src/views/Account.vue +2 -2
  47. package/src/views/Callback.vue +36 -33
  48. package/src/views/Login.vue +3 -3
  49. package/src/views/Reset.vue +132 -135
  50. package/src/views/Verify.vue +153 -151
@@ -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,117 +1,121 @@
1
- import to from 'await-to-js'
2
- import CompanyService from '../services/CompanyService'
3
- import {nextTick} from "vue";
4
- import QRCodeStyling from "qr-code-styling";
1
+ import to from 'await-to-js';
2
+ import CompanyService from '../services/CompanyService';
3
+ import { nextTick } from 'vue';
4
+ import QRCodeStyling from 'qr-code-styling';
5
5
 
6
6
  export default {
7
- data () {
8
- return {
9
- isQrCodeLogin: false,
10
- qrCode: null,
11
- qrCodeHash: null,
12
- qrCodeRefreshInterval: null,
13
- poolingInterval: null,
14
- }
15
- },
16
- props: {
17
- isModal: {
18
- type: Boolean,
19
- required: false,
20
- default: false,
21
- },
22
- },
23
- computed: {
24
- displayQRLogin () {
25
- return this.$route.name === 'AuthLogin' && this.display !== 'npm';
26
- }
27
- },
28
- mounted () {
29
- if (this.$route.name === 'AuthQR') this.changeLoginToQr();
30
- },
31
- methods: {
32
- async changeLoginToQr() {
33
- this.isQrCodeLogin = true;
34
- await nextTick();
35
- await this.initQrCodeLogin();
36
- },
37
- generateRandomHash() {
38
- const characters =
39
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
40
- const charactersLength = characters.length;
41
- let result = "";
7
+ data() {
8
+ return {
9
+ isQrCodeLogin: false,
10
+ qrCode: null,
11
+ qrCodeHash: null,
12
+ qrCodeRefreshInterval: null,
13
+ poolingInterval: null
14
+ };
15
+ },
16
+ props: {
17
+ isModal: {
18
+ type: Boolean,
19
+ required: false,
20
+ default: false
21
+ }
22
+ },
23
+ computed: {
24
+ displayQRLogin() {
25
+ return this.$route.name === 'AuthLogin' && this.display !== 'npm';
26
+ }
27
+ },
28
+ mounted() {
29
+ if (this.$route.name === 'AuthQR') this.changeLoginToQr();
30
+ },
31
+ methods: {
32
+ async changeLoginToQr() {
33
+ this.isQrCodeLogin = true;
34
+ await nextTick();
35
+ await this.initQrCodeLogin();
36
+ },
37
+ generateRandomHash() {
38
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
39
+ const charactersLength = characters.length;
40
+ let result = '';
42
41
 
43
- // Create an array of 32-bit unsigned integers
44
- const randomValues = new Uint32Array(32);
42
+ // Create an array of 32-bit unsigned integers
43
+ const randomValues = new Uint32Array(32);
45
44
 
46
- // Generate random values
47
- window.crypto.getRandomValues(randomValues);
48
- randomValues.forEach((value) => {
49
- result += characters.charAt(value % charactersLength);
50
- });
45
+ // Generate random values
46
+ window.crypto.getRandomValues(randomValues);
47
+ randomValues.forEach((value) => {
48
+ result += characters.charAt(value % charactersLength);
49
+ });
51
50
 
52
- return result;
53
- },
54
- refreshQrCode() {
55
- if (this.qrCode) {
56
- document.getElementById("qrCodeContainer")?.childNodes[0]?.remove();
57
- }
51
+ return result;
52
+ },
53
+ refreshQrCode() {
54
+ if (this.qrCode) {
55
+ document.getElementById('qrCodeContainer')?.childNodes[0]?.remove();
56
+ }
58
57
 
59
- this.qrCodeHash = this.generateRandomHash();
58
+ this.qrCodeHash = this.generateRandomHash();
60
59
 
61
- this.qrCode = new QRCodeStyling({
62
- width: 300,
63
- height: 300,
64
- type: "png",
65
- image: "",
66
- imageOptions: {
67
- margin: 15,
68
- },
69
- data: this.qrCodeHash,
70
- dotsOptions: {
71
- type: "extra-rounded",
72
- color: "#000000",
73
- },
74
- cornersSquareOptions: {
75
- type: "extra-rounded",
76
- color: "#000000",
77
- },
78
- cornersDotOptions: {
79
- type: "",
80
- color: "#000000",
81
- },
82
- backgroundOptions: {
83
- color: "#ffffff00",
84
- },
85
- });
60
+ this.qrCode = new QRCodeStyling({
61
+ width: 300,
62
+ height: 300,
63
+ type: 'png',
64
+ image: '',
65
+ imageOptions: {
66
+ margin: 15
67
+ },
68
+ data: this.qrCodeHash,
69
+ dotsOptions: {
70
+ type: 'extra-rounded',
71
+ color: '#000000'
72
+ },
73
+ cornersSquareOptions: {
74
+ type: 'extra-rounded',
75
+ color: '#000000'
76
+ },
77
+ cornersDotOptions: {
78
+ type: '',
79
+ color: '#000000'
80
+ },
81
+ backgroundOptions: {
82
+ color: '#ffffff00'
83
+ }
84
+ });
86
85
 
87
- this.qrCode.append(document.getElementById("qrCodeContainer"));
88
- },
89
- async startQrCodePooling() {
90
- this.poolingInterval = setInterval(async () => {
91
- const [err, response] = await to(CompanyService.qrCodePooling({
92
- qrToken: this.qrCodeHash,
93
- }, this.$storex));
94
- if (err) return this.errorHandler(err);
95
- if (response.data.auth_code) {
96
- if (this.display !== 'popup') {
97
- this.loginSetup({ ...response, isModal: this.isModal });
98
- await this.getLoggedInAccounts();
99
- }
86
+ this.qrCode.append(document.getElementById('qrCodeContainer'));
87
+ },
88
+ async startQrCodePooling() {
89
+ this.poolingInterval = setInterval(async () => {
90
+ const [err, response] = await to(
91
+ CompanyService.qrCodePooling(
92
+ {
93
+ qrToken: this.qrCodeHash
94
+ },
95
+ this.$storex
96
+ )
97
+ );
98
+ if (err) return this.errorHandler(err);
99
+ if (response.data.auth_code) {
100
+ if (this.display !== 'popup') {
101
+ this.loginSetup({ ...response, isModal: this.isModal });
102
+ await this.getLoggedInAccounts();
103
+ }
100
104
 
101
- this.loginSuccess({ ...response, isModal: this.isModal });
102
- clearInterval(this.poolingInterval);
103
- clearInterval(this.qrCodeRefreshInterval);
104
- }
105
- }, 2000);
106
- },
105
+ this.loginSuccess({ ...response, isModal: this.isModal });
106
+ clearInterval(this.poolingInterval);
107
+ clearInterval(this.qrCodeRefreshInterval);
108
+ }
109
+ }, 2000);
110
+ },
107
111
 
108
- async initQrCodeLogin() {
109
- this.refreshQrCode();
110
- await nextTick();
111
- await this.startQrCodePooling();
112
- this.qrCodeRefreshInterval = setInterval(() => {
113
- this.refreshQrCode();
114
- }, 60000);
115
- },
116
- }
117
- }
112
+ async initQrCodeLogin() {
113
+ this.refreshQrCode();
114
+ await nextTick();
115
+ await this.startQrCodePooling();
116
+ this.qrCodeRefreshInterval = setInterval(() => {
117
+ this.refreshQrCode();
118
+ }, 60000);
119
+ }
120
+ }
121
+ };
@@ -1,9 +1,9 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
- import routes from '../routes.js'
1
+ import { createRouter, createWebHistory } from 'vue-router';
2
+ import routes from '../routes.js';
3
3
 
4
4
  const router = createRouter({
5
- history: createWebHistory(import.meta.env.BASE_URL),
6
- routes
7
- })
5
+ history: createWebHistory(import.meta.env.BASE_URL),
6
+ routes
7
+ });
8
8
 
9
- export default router
9
+ export default router;
package/src/routes.js CHANGED
@@ -26,7 +26,7 @@ export default [
26
26
  {
27
27
  path: "/callback/saml",
28
28
  name: "Callback",
29
- alias: ['/callback/okta', '/callback/auth'],
29
+ alias: ['/callback/okta', '/callback/auth', '/callback/redirect'],
30
30
  component: Callback,
31
31
  },
32
32
  {
@@ -1,60 +1,58 @@
1
- import axios from 'axios'
2
- import { jwtDecode } from "jwt-decode";
3
- import { version } from "../../package.json"
1
+ import axios from 'axios';
2
+ import { jwtDecode } from 'jwt-decode';
3
+ import { version } from '../../package.json';
4
4
  import store from '../store/store.js';
5
5
 
6
6
  export default (refreshTokenAction = null) => {
7
- const appInfo = version;
8
- let baseURL = import.meta.env.VITE_APP_API_ROOT + '/v1/';
9
-
10
- if (store.getters['auth/apiRoot']) {
11
- baseURL = store.getters['auth/apiRoot'] + '/v1/';
12
- }
13
-
14
- let apiInstance = axios.create({
15
- baseURL,
16
- headers: {
17
- Authorization: `Bearer ${store.getters['auth/accessToken']}`,
18
- "X-Client-Name": "sso-" + appInfo.platform,
19
- "X-Client-Version": appInfo.version
20
- }
21
- })
22
-
23
- // Add a request interceptor
24
- apiInstance.interceptors.request.use(async function (config) {
25
-
26
- if (['post', 'put', 'delete'].includes(config.method.toLowerCase())) {
27
- config.data = {
28
- ...config.data,
29
- lang: store.getters['auth/appLanguage'],
30
- realm: store.getters['auth/appRealm'] || 'app'
31
- }
32
- } else if (config.method.toLowerCase() === 'get') {
33
- config.params = {
34
- ...config.params,
35
- lang: store.getters['auth/appLanguage'],
36
- realm: store.getters['auth/appRealm'] || 'app'
37
- }
38
- }
39
-
40
- // Check refresh token expiration before request is sent
41
- if (store.getters['auth/accessToken'] && !refreshTokenAction) {
42
- const decoded = jwtDecode(store.getters['auth/accessToken'])
43
-
44
- // Check if access token expired
45
- if (decoded.exp - 30 < Math.floor(Date.now() / 1000)) {
46
- return store.dispatch('auth/refreshTokenAction', decoded)
47
- .then(() => {
48
- config.headers = {
49
- ...config.headers,
50
- Authorization: `Bearer ${store.getters['auth/accessToken']}`
51
- }
52
- return config;
53
- })
54
- }
55
- }
56
- return config;
57
- });
58
-
59
- return apiInstance;
60
- }
7
+ const appInfo = version;
8
+ let baseURL = import.meta.env.VITE_APP_API_ROOT + '/v1/';
9
+
10
+ if (store.getters['auth/apiRoot']) {
11
+ baseURL = store.getters['auth/apiRoot'] + '/v1/';
12
+ }
13
+
14
+ let apiInstance = axios.create({
15
+ baseURL,
16
+ headers: {
17
+ Authorization: `Bearer ${store.getters['auth/accessToken']}`,
18
+ 'X-Client-Name': 'sso-' + appInfo.platform,
19
+ 'X-Client-Version': appInfo.version
20
+ }
21
+ });
22
+
23
+ // Add a request interceptor
24
+ apiInstance.interceptors.request.use(async function (config) {
25
+ if (['post', 'put', 'delete'].includes(config.method.toLowerCase())) {
26
+ config.data = {
27
+ ...config.data,
28
+ lang: store.getters['auth/appLanguage'],
29
+ realm: store.getters['auth/appRealm'] || 'app'
30
+ };
31
+ } else if (config.method.toLowerCase() === 'get') {
32
+ config.params = {
33
+ ...config.params,
34
+ lang: store.getters['auth/appLanguage'],
35
+ realm: store.getters['auth/appRealm'] || 'app'
36
+ };
37
+ }
38
+
39
+ // Check refresh token expiration before request is sent
40
+ if (store.getters['auth/accessToken'] && !refreshTokenAction) {
41
+ const decoded = jwtDecode(store.getters['auth/accessToken']);
42
+
43
+ // Check if access token expired
44
+ if (decoded.exp - 30 < Math.floor(Date.now() / 1000)) {
45
+ return store.dispatch('auth/refreshTokenAction', decoded).then(() => {
46
+ config.headers = {
47
+ ...config.headers,
48
+ Authorization: `Bearer ${store.getters['auth/accessToken']}`
49
+ };
50
+ return config;
51
+ });
52
+ }
53
+ }
54
+ return config;
55
+ });
56
+
57
+ return apiInstance;
58
+ };
@@ -1,13 +1,13 @@
1
1
  import api from './Api';
2
2
 
3
3
  export default {
4
- getBySSOEmail (email) {
5
- return api().get(`/company/sso/${email}`)
6
- },
7
- acceptCompanyInvitation (code) {
8
- return api().get(`/users/invitation?ic=${code}`)
9
- },
10
- qrCodePooling(payload) {
11
- return api().post("/company/login/qr", payload);
12
- },
13
- }
4
+ getBySSOEmail(email) {
5
+ return api().get(`/company/sso/${email}`);
6
+ },
7
+ acceptCompanyInvitation(code) {
8
+ return api().get(`/users/invitation?ic=${code}`);
9
+ },
10
+ qrCodePooling(payload) {
11
+ return api().post('/company/login/qr', payload);
12
+ }
13
+ };
@@ -2,9 +2,9 @@ import api from './Api';
2
2
 
3
3
  export default {
4
4
  registerDevice(data) {
5
- return api().post(`/devices/add`, data)
5
+ return api().post(`/devices/add`, data);
6
6
  },
7
7
  addFcmToken(data) {
8
- return api().post(`/devices/fcm/add`, data)
8
+ return api().post(`/devices/fcm/add`, data);
9
9
  }
10
- }
10
+ };
@@ -1,49 +1,49 @@
1
1
  import api from './Api.js';
2
2
 
3
3
  export default {
4
- getMe() {
5
- return api().get(`/users/me`);
6
- },
7
- getByUsername(data) {
8
- let referrer = document.referrer || "";
9
- let params = data.utmParams || {};
10
- if (data.dontTap) params.dontTap = true;
11
- return api().get(`/users/${data.username}`, {
12
- params,
13
- headers: { "X-Referer": referrer },
14
- });
15
- },
16
- getByNumber(data) {
17
- let referrer = document.referrer || "";
18
- let params = data.utmParams || {};
19
- if (data.dontTap) params.dontTap = true;
20
- return api().get(`/users/tag/${data.serial}`, {
21
- params,
22
- headers: { "X-Referer": referrer },
23
- });
24
- },
25
- save(data) {
26
- return api().put(`/users`, data);
27
- },
28
- newPassword(data) {
29
- return api().put(`/users/new-password`, data);
30
- },
31
- connect(data) {
32
- return api().post(`/users/connect`, data);
33
- },
34
- eventLog(data) {
35
- return api().post(`/users/log`, data);
36
- },
37
- deleteAccount(data) {
38
- return api().post(`/users/profile/delete`, data);
39
- },
40
- registerDevice(data) {
41
- return api().post(`/users/device/register`, data);
42
- },
43
- addFcmToken(data) {
44
- return api().post(`/users/device/fcm`, data);
45
- },
46
- loginUsingQR(data) {
47
- return api().post("/users/qr/login", data);
48
- }
4
+ getMe() {
5
+ return api().get(`/users/me`);
6
+ },
7
+ getByUsername(data) {
8
+ let referrer = document.referrer || '';
9
+ let params = data.utmParams || {};
10
+ if (data.dontTap) params.dontTap = true;
11
+ return api().get(`/users/${data.username}`, {
12
+ params,
13
+ headers: { 'X-Referer': referrer }
14
+ });
15
+ },
16
+ getByNumber(data) {
17
+ let referrer = document.referrer || '';
18
+ let params = data.utmParams || {};
19
+ if (data.dontTap) params.dontTap = true;
20
+ return api().get(`/users/tag/${data.serial}`, {
21
+ params,
22
+ headers: { 'X-Referer': referrer }
23
+ });
24
+ },
25
+ save(data) {
26
+ return api().put(`/users`, data);
27
+ },
28
+ newPassword(data) {
29
+ return api().put(`/users/new-password`, data);
30
+ },
31
+ connect(data) {
32
+ return api().post(`/users/connect`, data);
33
+ },
34
+ eventLog(data) {
35
+ return api().post(`/users/log`, data);
36
+ },
37
+ deleteAccount(data) {
38
+ return api().post(`/users/profile/delete`, data);
39
+ },
40
+ registerDevice(data) {
41
+ return api().post(`/users/device/register`, data);
42
+ },
43
+ addFcmToken(data) {
44
+ return api().post(`/users/device/fcm`, data);
45
+ },
46
+ loginUsingQR(data) {
47
+ return api().post('/users/qr/login', data);
48
+ }
49
49
  };