@tapni/auth 0.0.2 → 0.0.4

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/dist/TapniAuth.es.js +2 -2
  2. package/dist/TapniAuth.umd.js +2 -2
  3. package/package.json +3 -2
  4. package/src/App.vue +269 -0
  5. package/src/components/Language.vue +158 -0
  6. package/src/components/LinkIcon.vue +288 -0
  7. package/src/components/ModalOverlay.vue +67 -0
  8. package/src/components/SSO.vue +126 -0
  9. package/src/components/SSOPick.vue +166 -0
  10. package/src/install.js +8 -0
  11. package/src/main.js +96 -0
  12. package/src/mixins/apple.mixin.js +60 -0
  13. package/src/mixins/auth.mixin.js +525 -0
  14. package/src/mixins/facebook.mixin.js +78 -0
  15. package/src/mixins/global.mixin.js +110 -0
  16. package/src/mixins/google.mixin.js +61 -0
  17. package/src/mixins/microsoft.mixin.js +88 -0
  18. package/src/mixins/okta.mixin.js +132 -0
  19. package/src/mixins/qr-auth.mixin.js +112 -0
  20. package/src/mixins/saml.mixin.js +84 -0
  21. package/src/router/index.js +9 -0
  22. package/src/routes.js +55 -0
  23. package/src/services/Api.js +55 -0
  24. package/src/services/AuthService.js +71 -0
  25. package/src/services/CompanyService.js +13 -0
  26. package/src/services/DeviceService.js +10 -0
  27. package/src/services/UserService.js +49 -0
  28. package/src/services/UtilService.js +221 -0
  29. package/src/store/constants.js +8 -0
  30. package/src/store/event-bus.js +30 -0
  31. package/src/store/locales/cn.js +462 -0
  32. package/src/store/locales/de.js +528 -0
  33. package/src/store/locales/en.js +514 -0
  34. package/src/store/locales/es.js +536 -0
  35. package/src/store/locales/fr.js +520 -0
  36. package/src/store/locales/it.js +518 -0
  37. package/src/store/locales/kr.js +496 -0
  38. package/src/store/locales/lang.js +47 -0
  39. package/src/store/locales/sr.js +497 -0
  40. package/src/store/locales/tr.js +491 -0
  41. package/src/styles/framework.css +4012 -0
  42. package/src/styles/inter.ttf +0 -0
  43. package/src/styles/style.css +618 -0
  44. package/src/views/Callback.vue +47 -0
  45. package/src/views/Login.vue +389 -0
  46. package/src/views/QR.vue +39 -0
  47. package/src/views/Register.vue +217 -0
  48. package/src/views/Reset.vue +155 -0
  49. package/src/views/Verify.vue +170 -0
  50. package/src/views/Welcome.vue +69 -0
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <form v-if="!passwordChange" class="page-login content-boxed content-boxed-padding" @submit.prevent="resetEmail" autocomplete="on">
3
+ <h3 class="bold no-bottom center-text" style="margin-top: 63px;">{{ssoLang[this.appLang].reset_password}}</h3>
4
+ <p class="half-bottom small-top center-text color-black"></p>
5
+ <div class="page-login-field half-top color-black">
6
+ <i style="padding-top: 15px; margin-left: 10px;">
7
+ <img src="https://cdn.tapni.co/icons/mail.png" class="responsive-image" style="width: 80%;">
8
+ </i>
9
+ <input id="emailInput" v-model="email" @keydown.space.prevent type="email" :placeholder="ssoLang[this.appLang].email" required>
10
+ <em></em>
11
+ </div>
12
+ <button type="submit" class="button black-button google-button bg-tapni-grey button-90 button-center uppercase bold full-top">
13
+ <span v-if="!submitted" class="uppercase">{{ssoLang[this.appLang].reset_password}}</span>
14
+ <span v-else class="button--loading button__loader"></span>
15
+ </button>
16
+ <div class="decoration decoration-lines-thin no-bottom half-top"></div>
17
+ <p class="close-text center-text half-top color-black">
18
+ <span v-html="ssoLang[this.appLang].reset_password_p1"></span><a :href="'mailto:support@tapni.co?subject=' + ssoLang[this.appLang].password_reset_t"> support@tapni.co</a>
19
+ </p>
20
+ <div class="decoration decoration-lines-thin no-bottom half-top"></div>
21
+
22
+ <div class="page-login-links">
23
+ <router-link class="create float-right" to="/verify">{{ssoLang[this.appLang].verify_account}}</router-link>
24
+ <router-link class="forgot float-left" to="/login">{{ssoLang[this.appLang].sign_in}}</router-link>
25
+ <div class="clear"></div>
26
+ </div>
27
+ </form>
28
+ <form v-else class="page-login content-boxed content-boxed-padding" @submit.prevent="changePw">
29
+ <h3 class="bold no-bottom center-text" style="margin-top: 63px;">{{ssoLang[this.appLang].password_change}}</h3>
30
+ <p class="half-bottom small-top center-text color-black">{{ssoLang[this.appLang].password_new}}</p>
31
+ <div class="page-login-field half-top">
32
+ <i style="padding-top: 15px">
33
+ <img src="https://cdn.tapni.co/icons/padlock.png" class="responsive-image" style="width: 50%;">
34
+ </i>
35
+ <input v-model="password" :type="revealPassword ? 'text' : 'password'" :placeholder="ssoLang[this.appLang].password" required>
36
+ <em @click="revealPassword = !revealPassword">
37
+ <img v-show="!revealPassword" src="https://cdn.tapni.co/icons/reveal-password.png" class="responsive-image password-reveal-icon">
38
+ <img v-show="revealPassword" src="https://cdn.tapni.co/icons/hide-password.png" class="responsive-image password-reveal-icon">
39
+ </em>
40
+ </div>
41
+ <div class="page-login-field half-top">
42
+ <i style="padding-top: 15px">
43
+ <img src="https://cdn.tapni.co/icons/padlock.png" class="responsive-image" style="width: 50%;">
44
+ </i>
45
+ <input v-model="passwordRepeat" :type="revealPassword2 ? 'text' : 'password'" :placeholder="ssoLang[this.appLang].password_repeat" required>
46
+ <em @click="revealPassword2 = !revealPassword2">
47
+ <img v-show="!revealPassword2" src="https://cdn.tapni.co/icons/reveal-password.png" class="responsive-image password-reveal-icon">
48
+ <img v-show="revealPassword2" src="https://cdn.tapni.co/icons/hide-password.png" class="responsive-image password-reveal-icon">
49
+ </em>
50
+ </div>
51
+ <button type="submit" class="button black-button google-button bg-tapni-grey button-90 button-center uppercase bold full-top">
52
+ <span v-if="!submitted" class="uppercase">{{ssoLang[this.appLang].password_change}}</span>
53
+ <span v-else class="button--loading button__loader"></span>
54
+ </button>
55
+
56
+ <div class="decoration decoration-lines-thin no-bottom half-top"></div>
57
+ <p class="close-text center-text half-top color-black">
58
+ <span v-html="ssoLang[this.appLang].reset_password_p2"></span> <a :href="'mailto:support@tapni.co?subject=' + ssoLang[this.appLang].password_reset_t"> support@tapni.co</a>
59
+ </p>
60
+ </form>
61
+ </template>
62
+
63
+ <script>
64
+ import AuthMixin from "../mixins/auth.mixin";
65
+ import {EventBus} from "../store/event-bus";
66
+
67
+ export default {
68
+ name: 'AuthReset',
69
+ mixins: [AuthMixin],
70
+ data () {
71
+ return {
72
+ loading: true,
73
+ submitted: false,
74
+ passwordChange: false,
75
+ email: '',
76
+ password: '',
77
+ passwordRepeat: '',
78
+ code: '',
79
+ captcha: '',
80
+ revealPassword: false,
81
+ revealPassword2: false,
82
+ }
83
+ },
84
+ mounted () {
85
+ if (this.storage.verifyEmail) {
86
+ this.email = this.storage.verifyEmail
87
+ }
88
+ if (this.$route.query.c) {
89
+ this.code = this.$route.query.c;
90
+ this.passwordChange = true
91
+ }
92
+ if (this.$route.query.e) {
93
+ this.email = this.$route.query.e
94
+ }
95
+ EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
96
+ },
97
+ methods: {
98
+ async resetEmail() {
99
+ // if (this.captcha === '') return this.errorHandler({ message: 'Please select recaptcha' });
100
+
101
+ if (this.submitted) return
102
+ this.submitted = true
103
+
104
+ this.email = this.email.trim()
105
+
106
+ let data = {
107
+ email: this.email,
108
+ captchaToken: await this.getCaptchaToken('password_reset')
109
+ };
110
+
111
+ await this.reset(data)
112
+ this.submitted = false
113
+ await this.$router.push('/verify?e=' + this.email + '#reset')
114
+
115
+ },
116
+ async changePw() {
117
+ // if (this.captcha === '') return this._vm.errorHandler({ message: 'Please select recaptcha' });
118
+ if (this.code.length !== 6) return this.errorSnack(this.ssoLang[this.appLang].invalid_code);
119
+ if (this.password !== this.passwordRepeat) return this.errorSnack(this.ssoLang[this.appLang].password_not_match);
120
+
121
+ if (this.submitted) return
122
+ this.submitted = true
123
+
124
+ this.email = this.email.trim()
125
+ this.code = this.code.trim()
126
+
127
+ let data = {
128
+ email: this.email,
129
+ code: this.code,
130
+ password: this.password,
131
+ passwordRepeat: this.passwordRepeat,
132
+ captchaToken: await this.getCaptchaToken('password_reset')
133
+ };
134
+
135
+ let success = await this.changePassword(data)
136
+ this.submitted = false
137
+ if (success === true) {
138
+ this.$router.push('/login');
139
+ this.successSnack(this.ssoLang[this.appLang].password_reseted_success);
140
+ }
141
+ },
142
+ },
143
+ watch: {
144
+ email(nv) { this.storage.verifyEmail = nv }
145
+ }
146
+ }
147
+ </script>
148
+
149
+ <style scoped>
150
+ #emailInput {
151
+ text-align: center;
152
+ padding-right: 15%;
153
+ font-size: 17px;
154
+ }
155
+ </style>
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <form class="page-login content-boxed content-boxed-padding" @submit.prevent="submit" :style="isModal ? 'max-width: 500px;' : ''">
3
+ <a v-if="isModal" @click="close" class="color-black pull-right pointer" style="margin-top: 0px; position: absolute; right: -20px; text-align: right;">
4
+ <i class="font-17 color-black">
5
+ <img src="https://cdn.tapni.co/icons/down-arrow.png" class="responsive-image" style="width: 35%;"/>
6
+ </i>
7
+ </a>
8
+ <h1 class="bold no-bottom center-text" style="margin-top: 63px;">{{ssoLang[this.appLang].verify_account}}</h1>
9
+ <p class="half-bottom half-top center-text color-black"></p>
10
+ <div class="page-login-field half-top">
11
+ <i style="padding-top: 15px; margin-left: 10px;">
12
+ <img src="https://cdn.tapni.co/icons/mail.png" class="responsive-image" style="width: 80%;">
13
+ </i>
14
+ <input id="emailInput" v-model="email" @keydown.space.prevent type="email" :placeholder="ssoLang[this.appLang].email" required>
15
+ <em></em>
16
+ </div>
17
+ <div class="page-login-field half-top">
18
+ <i style="padding-top: 15px; margin-left: 10px;">
19
+ <img src="https://cdn.tapni.co/icons/password2.png" class="responsive-image" style="width: 100%;">
20
+ </i>
21
+ <input id="codeInput" v-model="code" @keydown.space.prevent type="tel" :placeholder="ssoLang[this.appLang].code" required>
22
+ <em></em>
23
+ </div>
24
+ <button type="submit" class="button black-button google-button bg-tapni-grey button-90 button-center uppercase bold full-top">
25
+ <span v-if="!submitted" class="uppercase">{{ssoLang[this.appLang].verify_account}}</span>
26
+ <span v-else class="button--loading button__loader"></span>
27
+ </button>
28
+ <div class="decoration decoration-lines-thin no-bottom"></div>
29
+
30
+ <p class="close-text center-text half-top color-black">
31
+ <span v-html="ssoLang[this.appLang].verify_account_p1"></span>
32
+ <a href="mailto:support@tapni.co?subject=Email Verification"> support@tapni.co</a>
33
+ </p>
34
+
35
+ <div class="decoration decoration-lines-thin no-bottom"></div>
36
+ <div v-if="!isModal" class="page-login-links">
37
+ <router-link class="create float-right" to="/register">{{ssoLang[this.appLang].register}}</router-link>
38
+ <router-link class="forgot float-left" to="/login">{{ssoLang[this.appLang].sign_in}}</router-link>
39
+ <div class="clear"></div>
40
+ </div>
41
+ <div v-else class="page-login-links" @click="registerAccountModal">
42
+ <a class="forgot center-text pointer small-top">{{ssoLang[this.appLang].or}} <br> {{ssoLang[this.appLang].create_new_account}}</a>
43
+ <div class="clear"></div>
44
+ </div>
45
+ </form>
46
+ </template>
47
+
48
+ <script>
49
+ import {EventBus} from "../store/event-bus";
50
+ import AuthMixin from "../mixins/auth.mixin";
51
+ export default {
52
+ name: 'AuthVerify',
53
+ mixins: [AuthMixin],
54
+ props: {
55
+ isModal: {
56
+ type: Boolean,
57
+ required: false,
58
+ default: false
59
+ },
60
+ },
61
+ data () {
62
+ return {
63
+ loading: true,
64
+ submitted: false,
65
+ action: 'verify',
66
+ email: '',
67
+ code: '',
68
+ captcha: ''
69
+ }
70
+ },
71
+ mounted () {
72
+ if (this.storage.verifyEmail) this.email = this.storage.verifyEmail
73
+ if (this.$route) this.init()
74
+ },
75
+ methods: {
76
+ init() {
77
+ if (this.isLoggedIn) {
78
+ this.$router.push(this.home)
79
+ } else {
80
+ if (this.storage.verifyEmail) {
81
+ this.email = this.storage.verifyEmail
82
+ }
83
+ if (this.$route.hash === '#reset') {
84
+ this.action = 'reset'
85
+ }
86
+ if (this.$route.query.e) {
87
+ this.email = this.$route.query.e
88
+ }
89
+ if (this.$route.query.c) {
90
+ this.code = this.$route.query.c
91
+ }
92
+ EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
93
+ }
94
+ },
95
+ async submit() {
96
+ // if (this.captcha === '') return this._vm.errorHandler({ message: 'Please select recaptcha' });
97
+ if (this.code.length !== 6) {
98
+ return this.errorSnack(this.ssoLang[this.appLang].invalid_code);
99
+ }
100
+
101
+ this.email = this.email.trim()
102
+ this.code = this.code.trim()
103
+
104
+ let data = {
105
+ code: this.code,
106
+ email: this.email,
107
+ captchaToken: await this.getCaptchaToken('account_verify')
108
+ }
109
+
110
+ if(this.submitted) return false;
111
+ this.submitted = true
112
+
113
+ let response = await this.verify(data);
114
+ this.submitted = false
115
+ if (response && response.data && response.data.success === true) {
116
+ if (this.action === 'reset') {
117
+ this.$router.push('/reset?c=' + this.code + '&e=' + this.email)
118
+ this.successSnack(this.ssoLang[this.appLang].verify_account_success)
119
+ }
120
+ if (this.action === 'verify') {
121
+ if (this.isModal) {
122
+ this.email = ''
123
+ this.code = ''
124
+ EventBus.$emit('closeModal')
125
+ }
126
+ await this.loginSetup(response)
127
+ this.getLoggedInAccounts()
128
+ this.storage.verifyEmail = '';
129
+ this.$router.push('/' + response.data.data.username + '#edit')
130
+ this.successSnack(this.ssoLang[this.appLang].verify_account_success2)
131
+ }
132
+ } else this.submitted = false
133
+
134
+ },
135
+ registerAccountModal () {
136
+ EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModalRegister', data: false})
137
+ },
138
+ close () {
139
+ EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModal', data: true})
140
+ },
141
+ },
142
+ watch: {
143
+ 'storage.verifyEmail' (nv) {
144
+ if (nv) this.email = nv
145
+ },
146
+ 'route.name' (nv, ov) {
147
+ if (!ov && nv) this.init()
148
+ },
149
+ 'route.query': {
150
+ handler(nv) {
151
+ if (!this.isEmpty(nv)) this.init()
152
+ },
153
+ deep: true,
154
+ },
155
+ }
156
+ }
157
+ </script>
158
+
159
+ <style scoped>
160
+ #codeInput {
161
+ text-align: center;
162
+ padding-right: 15%;
163
+ font-size: 17px;
164
+ }
165
+ #emailInput {
166
+ text-align: center;
167
+ padding-right: 15%;
168
+ font-size: 17px;
169
+ }
170
+ </style>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="page-login content-boxed content-boxed-padding center-text" style="margin-top: -1px; overflow: hidden; border: solid 0px #ffffff;">
3
+ <video id="tapniVideo" muted loop playsinline width="350" style="margin: 0 auto; max-width: 100%; margin-top: 63px; overflow: hidden;" :autoplay="isNative">
4
+ <source src="https://cdn.tapni.co/images/tapni-card-tap-video-white.mp4" type="video/mp4">
5
+ </video>
6
+ <h1 class="bold full-top no-bottom center-text">{{ssoLang[this.appLang].welcome}}</h1>
7
+ <p class="full-bottom half-top center-text color-black font-16">{{ssoLang[this.appLang].welcome_p1}}</p>
8
+ <router-link v-if="false" to="/help" class="button-center button button-90 google-button pointer edit-shadow full-top full-bottom">
9
+ <span> {{ssoLang[this.appLang].how_it_works}}? </span>
10
+ </router-link>
11
+ <div v-if="false" class="decoration decoration-lines-thin full-top"></div>
12
+ <router-link to="register" exact class="button-center button button-90 google-button bg-tapni-grey pointer">
13
+ <span> {{ssoLang[this.appLang].create_account}} </span>
14
+ </router-link>
15
+ <!--
16
+ <button @click="test" class="button-center button button-90 google-button bg-tapni-grey pointer">
17
+ Test
18
+ </button>
19
+ -->
20
+ <div class="page-login-links center-text">
21
+ <router-link to="/login">{{ssoLang[this.appLang].already_registered}}? <b>{{ssoLang[this.appLang].sign_in}}</b></router-link>
22
+ <div class="clear"></div>
23
+ </div>
24
+ <div v-if=(!this.isNative) style="display: flex; flex-direction: row; justify-content: space-around; width: 90%; margin: 0 auto; margin-top: 40px;" >
25
+ <a href="https://play.google.com/store/apps/details?id=co.tapni.app" target="_blank"><img src="https://cdn.tapni.co/images/playstore.png" class="app-store-icon pointer" style="width:55px"/></a>
26
+ <a href="https://apps.apple.com/ag/app/tapni/id1552930233" target="_blank"><img src="https://cdn.tapni.co/images/appstore.png" class="app-store-icon pointer" style="width:55px"/></a>
27
+ <a href="https://appgallery.huawei.com/#/app/C103931997" target="_blank"><img src="https://cdn.tapni.co/images/appgallery.png" class="app-store-icon pointer" style="width:55px"/></a>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import AuthMixin from "../mixins/auth.mixin";
34
+ import {EventBus} from "../store/event-bus";
35
+
36
+ export default {
37
+ name: 'AuthWelcome',
38
+ mixins: [AuthMixin],
39
+ data () {
40
+ return {
41
+ loading: true
42
+ }
43
+ },
44
+ async mounted () {
45
+ // Autoplay video - iOS 12 controls fix
46
+ const video = document.getElementById('tapniVideo');
47
+ video.play();
48
+
49
+ setTimeout(() => {
50
+ if (this.storage.token) {
51
+ this.$router.push(this.home)
52
+ } else {
53
+ EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
54
+ }
55
+ }, 1500)
56
+
57
+ EventBus.$emit('ssoEvent', {name: 'setInitialize', data: true})
58
+ },
59
+ methods: {
60
+ }
61
+ }
62
+ </script>
63
+
64
+ <style scoped>
65
+ .app-store-icon {
66
+ box-shadow: 0px 4px 10px 0px rgb(0 0 0 / 9%);
67
+ border-radius: 12px;
68
+ }
69
+ </style>