@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.
- package/dist/TapniAuth.es.js +2 -2
- package/dist/TapniAuth.umd.js +2 -2
- package/package.json +3 -2
- package/src/App.vue +269 -0
- package/src/components/Language.vue +158 -0
- package/src/components/LinkIcon.vue +288 -0
- package/src/components/ModalOverlay.vue +67 -0
- package/src/components/SSO.vue +126 -0
- package/src/components/SSOPick.vue +166 -0
- package/src/install.js +8 -0
- package/src/main.js +96 -0
- package/src/mixins/apple.mixin.js +60 -0
- package/src/mixins/auth.mixin.js +525 -0
- package/src/mixins/facebook.mixin.js +78 -0
- package/src/mixins/global.mixin.js +110 -0
- package/src/mixins/google.mixin.js +61 -0
- package/src/mixins/microsoft.mixin.js +88 -0
- package/src/mixins/okta.mixin.js +132 -0
- package/src/mixins/qr-auth.mixin.js +112 -0
- package/src/mixins/saml.mixin.js +84 -0
- package/src/router/index.js +9 -0
- package/src/routes.js +55 -0
- package/src/services/Api.js +55 -0
- package/src/services/AuthService.js +71 -0
- package/src/services/CompanyService.js +13 -0
- package/src/services/DeviceService.js +10 -0
- package/src/services/UserService.js +49 -0
- package/src/services/UtilService.js +221 -0
- package/src/store/constants.js +8 -0
- package/src/store/event-bus.js +30 -0
- package/src/store/locales/cn.js +462 -0
- package/src/store/locales/de.js +528 -0
- package/src/store/locales/en.js +514 -0
- package/src/store/locales/es.js +536 -0
- package/src/store/locales/fr.js +520 -0
- package/src/store/locales/it.js +518 -0
- package/src/store/locales/kr.js +496 -0
- package/src/store/locales/lang.js +47 -0
- package/src/store/locales/sr.js +497 -0
- package/src/store/locales/tr.js +491 -0
- package/src/styles/framework.css +4012 -0
- package/src/styles/inter.ttf +0 -0
- package/src/styles/style.css +618 -0
- package/src/views/Callback.vue +47 -0
- package/src/views/Login.vue +389 -0
- package/src/views/QR.vue +39 -0
- package/src/views/Register.vue +217 -0
- package/src/views/Reset.vue +155 -0
- package/src/views/Verify.vue +170 -0
- package/src/views/Welcome.vue +69 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form
|
|
3
|
+
class="page-login content-boxed content-boxed-padding"
|
|
4
|
+
@submit.prevent="submit"
|
|
5
|
+
autocomplete="on"
|
|
6
|
+
:style="isModal ? 'max-width: 500px;' : ''"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
v-if="isModal"
|
|
10
|
+
@click="close"
|
|
11
|
+
class="color-black pull-right pointer"
|
|
12
|
+
style="
|
|
13
|
+
margin-top: 0px;
|
|
14
|
+
position: absolute;
|
|
15
|
+
right: -20px;
|
|
16
|
+
text-align: right;
|
|
17
|
+
"
|
|
18
|
+
>
|
|
19
|
+
<i class="font-17 color-black">
|
|
20
|
+
<img
|
|
21
|
+
src="https://cdn.tapni.co/icons/down-arrow.png"
|
|
22
|
+
class="responsive-image"
|
|
23
|
+
style="width: 35%"
|
|
24
|
+
/>
|
|
25
|
+
</i>
|
|
26
|
+
</a>
|
|
27
|
+
<h1 class="bold no-bottom center-text" style="margin-top: 63px;">
|
|
28
|
+
{{ this.ssoLang[this.appLang].login }}
|
|
29
|
+
</h1>
|
|
30
|
+
<p class="half-bottom small-top center-text color-black"></p>
|
|
31
|
+
|
|
32
|
+
<span v-if="displayFormLogin">
|
|
33
|
+
<div class="page-login-field half-top">
|
|
34
|
+
<i style="padding-top: 15px">
|
|
35
|
+
<img
|
|
36
|
+
src="https://cdn.tapni.co/icons/user.png"
|
|
37
|
+
class="responsive-image"
|
|
38
|
+
style="width: 50%"
|
|
39
|
+
/>
|
|
40
|
+
</i>
|
|
41
|
+
<input
|
|
42
|
+
v-model="emailOrUsername"
|
|
43
|
+
@keydown.space.prevent
|
|
44
|
+
autocorrect="off"
|
|
45
|
+
autocapitalize="off"
|
|
46
|
+
spellcheck="false"
|
|
47
|
+
type="text"
|
|
48
|
+
name="email"
|
|
49
|
+
:placeholder="ssoLang[this.appLang].email_username"
|
|
50
|
+
required
|
|
51
|
+
/>
|
|
52
|
+
<em></em>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="page-login-field half-bottom">
|
|
55
|
+
<i style="padding-top: 15px">
|
|
56
|
+
<img
|
|
57
|
+
src="https://cdn.tapni.co/icons/padlock.png"
|
|
58
|
+
class="responsive-image"
|
|
59
|
+
style="width: 50%"
|
|
60
|
+
/>
|
|
61
|
+
</i>
|
|
62
|
+
<input
|
|
63
|
+
v-model="password"
|
|
64
|
+
:type="revealPassword ? 'text' : 'password'"
|
|
65
|
+
:placeholder="ssoLang[this.appLang].password"
|
|
66
|
+
name="password"
|
|
67
|
+
required
|
|
68
|
+
minlength="8"
|
|
69
|
+
/>
|
|
70
|
+
<em @click="revealPassword = !revealPassword" class="pointer">
|
|
71
|
+
<img
|
|
72
|
+
v-show="!revealPassword"
|
|
73
|
+
src="https://cdn.tapni.co/icons/reveal-password.png"
|
|
74
|
+
class="responsive-image password-reveal-icon"
|
|
75
|
+
/>
|
|
76
|
+
<img
|
|
77
|
+
v-show="revealPassword"
|
|
78
|
+
src="https://cdn.tapni.co/icons/hide-password.png"
|
|
79
|
+
class="responsive-image password-reveal-icon"
|
|
80
|
+
/>
|
|
81
|
+
</em>
|
|
82
|
+
</div>
|
|
83
|
+
<button
|
|
84
|
+
type="submit"
|
|
85
|
+
class="button black-button google-button bg-tapni-grey button-90 button-center uppercase bold full-top"
|
|
86
|
+
>
|
|
87
|
+
<span v-if="!submitted">{{ ssoLang[appLang].login }}</span>
|
|
88
|
+
<span v-else class="button--loading button__loader"></span>
|
|
89
|
+
</button>
|
|
90
|
+
</span>
|
|
91
|
+
<div class="decoration decoration-lines-thin half-top half-bottom"></div>
|
|
92
|
+
<!-- Apple Login Button -->
|
|
93
|
+
<a
|
|
94
|
+
@click="appleLogin"
|
|
95
|
+
v-if="displayAppleLogin"
|
|
96
|
+
class="button-center button button-90 google-button pointer"
|
|
97
|
+
>
|
|
98
|
+
<img
|
|
99
|
+
src="https://cdn.tapni.co/icons/apple-logo.png"
|
|
100
|
+
style="
|
|
101
|
+
position: absolute;
|
|
102
|
+
margin-left: -11px;
|
|
103
|
+
padding: 8px 0;
|
|
104
|
+
height: 100%;
|
|
105
|
+
"
|
|
106
|
+
/>
|
|
107
|
+
<span v-if="!appleLoad">{{ ssoLang[appLang].sign_in_with }} Apple</span>
|
|
108
|
+
<span v-else class="button--loading button__loader"></span>
|
|
109
|
+
</a>
|
|
110
|
+
|
|
111
|
+
<!-- Google Login Button -->
|
|
112
|
+
<a
|
|
113
|
+
@click="googleLogin"
|
|
114
|
+
v-if="displayGoogleLogin"
|
|
115
|
+
class="button-center button button-90 google-button pointer"
|
|
116
|
+
>
|
|
117
|
+
<img
|
|
118
|
+
src="https://cdn.tapni.co/icons/g-logo.png"
|
|
119
|
+
style="
|
|
120
|
+
position: absolute;
|
|
121
|
+
margin-left: -10px;
|
|
122
|
+
padding: 8px 0;
|
|
123
|
+
height: 100%;
|
|
124
|
+
"
|
|
125
|
+
/>
|
|
126
|
+
<span v-if="!googleLoad"
|
|
127
|
+
>{{ ssoLang[appLang].sign_in_with }} Google</span
|
|
128
|
+
>
|
|
129
|
+
<span v-else class="button--loading-black button__loader"></span>
|
|
130
|
+
</a>
|
|
131
|
+
|
|
132
|
+
<!-- Facebook Login Button -->
|
|
133
|
+
<a
|
|
134
|
+
@click="facebookLogin"
|
|
135
|
+
v-if="displayFacebookLogin"
|
|
136
|
+
class="button-center button button-90 google-button pointer"
|
|
137
|
+
>
|
|
138
|
+
<img
|
|
139
|
+
src="https://cdn.tapni.co/icons/facebook-blue.png"
|
|
140
|
+
style="
|
|
141
|
+
position: absolute;
|
|
142
|
+
margin-left: -9px;
|
|
143
|
+
padding: 10px 0;
|
|
144
|
+
height: 100%;
|
|
145
|
+
"
|
|
146
|
+
/>
|
|
147
|
+
<span v-if="!facebookLoad"
|
|
148
|
+
>{{ ssoLang[appLang].sign_in_with }} Facebook</span
|
|
149
|
+
>
|
|
150
|
+
<span v-else class="button--loading-black button__loader"></span>
|
|
151
|
+
</a>
|
|
152
|
+
|
|
153
|
+
<!-- Microsoft Login Button -->
|
|
154
|
+
<a
|
|
155
|
+
@click="microsoftLogin"
|
|
156
|
+
v-if="!displayMicrosoftSSOLogin"
|
|
157
|
+
class="button-center button button-90 google-button pointer"
|
|
158
|
+
>
|
|
159
|
+
<img
|
|
160
|
+
src="https://cdn.tapni.co/icons/outlook.png"
|
|
161
|
+
style="
|
|
162
|
+
position: absolute;
|
|
163
|
+
margin-left: -8px;
|
|
164
|
+
padding: 10px 0;
|
|
165
|
+
height: 100%;
|
|
166
|
+
"
|
|
167
|
+
/>
|
|
168
|
+
<span v-if="!microsoftLoad"
|
|
169
|
+
>{{ ssoLang[appLang].sign_in_with }} Outlook</span
|
|
170
|
+
>
|
|
171
|
+
<span v-else class="button--loading-black button__loader"></span>
|
|
172
|
+
</a>
|
|
173
|
+
|
|
174
|
+
<!-- Microsoft SSO Button -->
|
|
175
|
+
<a
|
|
176
|
+
@click="ssoLogin"
|
|
177
|
+
v-if="!displayMicrosoftSSOLogin"
|
|
178
|
+
class="button-center button button-90 google-button pointer"
|
|
179
|
+
>
|
|
180
|
+
<img
|
|
181
|
+
src="https://cdn.tapni.co/icons/sso-key.png"
|
|
182
|
+
style="
|
|
183
|
+
position: absolute;
|
|
184
|
+
margin-left: -8px;
|
|
185
|
+
padding: 10px 0;
|
|
186
|
+
height: 100%;
|
|
187
|
+
"
|
|
188
|
+
/>
|
|
189
|
+
<span v-if="!microsoftSSOLoad">{{ ssoLang[appLang].sign_in_with }} SSO</span>
|
|
190
|
+
<span v-else class="button--loading-black button__loader"></span>
|
|
191
|
+
</a>
|
|
192
|
+
<!-- Microsoft SSO Button -->
|
|
193
|
+
<a
|
|
194
|
+
@click="microsoftLogin('sso')"
|
|
195
|
+
v-if="displayMicrosoftSSOLogin"
|
|
196
|
+
class="button-center button button-90 google-button pointer"
|
|
197
|
+
>
|
|
198
|
+
<img
|
|
199
|
+
src="https://cdn.tapni.co/icons/sso-key.png"
|
|
200
|
+
style="
|
|
201
|
+
position: absolute;
|
|
202
|
+
margin-left: -8px;
|
|
203
|
+
padding: 10px 0;
|
|
204
|
+
height: 100%;
|
|
205
|
+
"
|
|
206
|
+
/>
|
|
207
|
+
<span v-if="microsoftSSOLoad">{{ ssoLang[appLang].sign_in_with }} SSO</span>
|
|
208
|
+
<span v-else class="button--loading-black button__loader"></span>
|
|
209
|
+
</a>
|
|
210
|
+
|
|
211
|
+
<!-- Email Login Button -->
|
|
212
|
+
<a
|
|
213
|
+
@click="emailLogin = true"
|
|
214
|
+
v-if="!displayFormLogin"
|
|
215
|
+
class="button-center button button-90 google-button pointer"
|
|
216
|
+
>
|
|
217
|
+
<img
|
|
218
|
+
src="https://cdn.tapni.co/icons/mail.png"
|
|
219
|
+
style="
|
|
220
|
+
position: absolute;
|
|
221
|
+
margin-left: -8px;
|
|
222
|
+
padding: 12px 0;
|
|
223
|
+
height: 100%;
|
|
224
|
+
"
|
|
225
|
+
/>
|
|
226
|
+
<span>{{ ssoLang[appLang].sign_in_with }} Email</span>
|
|
227
|
+
</a>
|
|
228
|
+
|
|
229
|
+
<div class="decoration decoration-lines-thin no-bottom"></div>
|
|
230
|
+
|
|
231
|
+
<p class="close-text center-text half-top color-black">
|
|
232
|
+
{{ ssoLang[appLang].terms_by_signing_in }} <br />
|
|
233
|
+
<a class="" href="https://tapni.co/policies/terms-of-service">{{
|
|
234
|
+
ssoLang[this.appLang].terms_of_service
|
|
235
|
+
}}</a>
|
|
236
|
+
{{ ssoLang[appLang].and }}
|
|
237
|
+
<a href="https://tapni.co/policies/privacy-policy">{{
|
|
238
|
+
ssoLang[this.appLang].privacy_policy
|
|
239
|
+
}}</a>
|
|
240
|
+
</p>
|
|
241
|
+
<div class="decoration decoration-lines-thin no-bottom"></div>
|
|
242
|
+
<div v-if="!isModal" class="page-login-links">
|
|
243
|
+
<router-link
|
|
244
|
+
v-if="displayRegisterLogin"
|
|
245
|
+
class="forgot float-right"
|
|
246
|
+
to="/register"
|
|
247
|
+
>{{ ssoLang[appLang].create_account }}</router-link
|
|
248
|
+
>
|
|
249
|
+
<router-link
|
|
250
|
+
v-if="displayResetPasswordLogin"
|
|
251
|
+
class="create float-left"
|
|
252
|
+
to="/reset"
|
|
253
|
+
>{{ ssoLang[appLang].reset_password }}</router-link
|
|
254
|
+
>
|
|
255
|
+
<div class="clear"></div>
|
|
256
|
+
</div>
|
|
257
|
+
<div v-else class="page-login-links" @click="createAccountModal">
|
|
258
|
+
<a class="forgot center-text pointer small-top"
|
|
259
|
+
>{{ ssoLang[appLang].or }} <br />
|
|
260
|
+
{{ ssoLang[appLang].create_new_account }}</a
|
|
261
|
+
>
|
|
262
|
+
<div class="clear"></div>
|
|
263
|
+
</div>
|
|
264
|
+
</form>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<script>
|
|
268
|
+
import GoogleMixin from "../mixins/google.mixin";
|
|
269
|
+
import FacebookMixin from "../mixins/facebook.mixin";
|
|
270
|
+
import AppleMixin from "../mixins/apple.mixin";
|
|
271
|
+
import MicrosoftMixin from "../mixins/microsoft.mixin";
|
|
272
|
+
import OktaMixin from "../mixins/okta.mixin";
|
|
273
|
+
import SamlMixin from "../mixins/saml.mixin";
|
|
274
|
+
import AuthMixin from "../mixins/auth.mixin";
|
|
275
|
+
import QRAuthMixin from "../mixins/qr-auth.mixin";
|
|
276
|
+
import { EventBus } from "../store/event-bus";
|
|
277
|
+
import to from "await-to-js";
|
|
278
|
+
import AuthService from "@/services/AuthService";
|
|
279
|
+
export default {
|
|
280
|
+
name: "AuthLogin",
|
|
281
|
+
mixins: [GoogleMixin, FacebookMixin, AppleMixin, MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin, QRAuthMixin],
|
|
282
|
+
props: {
|
|
283
|
+
isModal: {
|
|
284
|
+
type: Boolean,
|
|
285
|
+
required: false,
|
|
286
|
+
default: false,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
data() {
|
|
290
|
+
return {
|
|
291
|
+
loading: true,
|
|
292
|
+
submitted: false,
|
|
293
|
+
emailOrUsername: "",
|
|
294
|
+
password: "",
|
|
295
|
+
captcha: "",
|
|
296
|
+
revealPassword: false,
|
|
297
|
+
emailLogin: true,
|
|
298
|
+
};
|
|
299
|
+
},
|
|
300
|
+
computed: {
|
|
301
|
+
displayFormLogin() {
|
|
302
|
+
return (
|
|
303
|
+
(this.company?.login?.form_login && !this.isModal) ?? this.emailLogin
|
|
304
|
+
);
|
|
305
|
+
},
|
|
306
|
+
displayResetPasswordLogin() {
|
|
307
|
+
return (this.company?.login?.reset_password && !this.isModal) ?? true;
|
|
308
|
+
},
|
|
309
|
+
displayRegisterLogin() {
|
|
310
|
+
return (this.company?.login?.create_account && !this.isModal) ?? true;
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
async mounted() {
|
|
314
|
+
if (!this.isModal) {
|
|
315
|
+
if(this.$route.path === '/login/callback/okta') return await this.handleOktaRedirect();
|
|
316
|
+
if(this.$route.path === '/login/callback/saml') return await this.handleSamlRedirect();
|
|
317
|
+
|
|
318
|
+
if (this.isLoggedIn) {
|
|
319
|
+
if (import.meta.env.VITE_APP_MODE === 'npm') this.$router.push(this.home);
|
|
320
|
+
else if (import.meta.env.VITE_APP_MODE === 'redirect') location.href = this.home
|
|
321
|
+
} else if (
|
|
322
|
+
!this.$route.query.state &&
|
|
323
|
+
!this.$route.query.oauth &&
|
|
324
|
+
!this.$route.params.oauth
|
|
325
|
+
) {
|
|
326
|
+
EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
|
|
327
|
+
}
|
|
328
|
+
EventBus.$emit('ssoEvent', {name: 'setInitialize', data: true})
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
methods: {
|
|
332
|
+
async submit() {
|
|
333
|
+
// if (this.captcha === '') return this._vm.errorHandler({ message: 'Please select recaptcha' });
|
|
334
|
+
if (this.submitted) return;
|
|
335
|
+
this.submitted = true;
|
|
336
|
+
|
|
337
|
+
this.emailOrUsername = this.emailOrUsername.trim();
|
|
338
|
+
|
|
339
|
+
let response_type = this.$route.query.response_type;
|
|
340
|
+
|
|
341
|
+
if (import.meta.env.VITE_APP_MODE === 'redirect') {
|
|
342
|
+
response_type = 'code'
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
let loginData = {
|
|
346
|
+
response_type: response_type || 'token',
|
|
347
|
+
isModal: this.isModal,
|
|
348
|
+
captcha: this.captcha,
|
|
349
|
+
password: this.password,
|
|
350
|
+
captchaToken: await this.getCaptchaToken('account_verify')
|
|
351
|
+
};
|
|
352
|
+
if (this.emailOrUsername.indexOf("@") !== -1) {
|
|
353
|
+
loginData.email = this.emailOrUsername;
|
|
354
|
+
} else {
|
|
355
|
+
loginData.username = this.emailOrUsername;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const [err, result] = await to(this.login(loginData));
|
|
359
|
+
if (err) console.error(err);
|
|
360
|
+
|
|
361
|
+
this.submitted = false;
|
|
362
|
+
|
|
363
|
+
if (result === true) {
|
|
364
|
+
this.emailOrUsername = "";
|
|
365
|
+
this.password = "";
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
close() {
|
|
369
|
+
EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModal', data: true})
|
|
370
|
+
},
|
|
371
|
+
createAccountModal() {
|
|
372
|
+
EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModalRegister', data: {}})
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
watch: {
|
|
376
|
+
emailOrUsername(nv) {
|
|
377
|
+
if (nv.includes("@")) {
|
|
378
|
+
this.storage.verifyEmail = nv;
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
'$route.path': async function(routePath) {
|
|
382
|
+
if(routePath === '/login/callback/okta') return await this.handleOktaRedirect();
|
|
383
|
+
if(routePath === '/login/callback/saml') return await this.handleSamlRedirect();
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
</script>
|
|
388
|
+
|
|
389
|
+
<style scoped></style>
|
package/src/views/QR.vue
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page-login content-boxed content-boxed-padding">
|
|
3
|
+
<h5 style="text-align: center; width: 80%; margin: 0 auto; margin-top: 130px;">
|
|
4
|
+
{{ ssoLang[appLang].use_tapni_on_the_web }}
|
|
5
|
+
</h5>
|
|
6
|
+
<br>
|
|
7
|
+
|
|
8
|
+
<div class="qrCodeLoginContainer center-text">
|
|
9
|
+
<div id="qrCodeContainer"
|
|
10
|
+
class="qrCodeRounded"
|
|
11
|
+
style="max-width: 100%;"/>
|
|
12
|
+
<br>
|
|
13
|
+
<br>
|
|
14
|
+
<div style="margin: 0 auto; width: 85%; text-align: left;">
|
|
15
|
+
<h2 class="center-text">{{ ssoLang[appLang].login_by_scanning_qr_code }}</h2>
|
|
16
|
+
<br>
|
|
17
|
+
<h4>{{ ssoLang[appLang].open_tapni_app_on_your_phone }}</h4>
|
|
18
|
+
<h4>{{ ssoLang[appLang].go_to_settings_link_a_device }}</h4>
|
|
19
|
+
<h4>{{ ssoLang[appLang].point_your_phone_at_this_qr_code }}</h4>
|
|
20
|
+
<br>
|
|
21
|
+
<br>
|
|
22
|
+
</div>
|
|
23
|
+
<router-link to="/login">{{ ssoLang[appLang].choose_other_login_methods }}</router-link>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import QRAuthMixin from "../mixins/qr-auth.mixin";
|
|
31
|
+
import AuthMixin from "../mixins/auth.mixin";
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name: "AuthQR",
|
|
35
|
+
mixins: [AuthMixin, QRAuthMixin],
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style scoped></style>
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form class="page-login content-boxed content-boxed-padding" @submit.prevent="submit" autocomplete="on" :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].register}}</h1>
|
|
9
|
+
<p class="half-bottom small-top center-text color-black">
|
|
10
|
+
<span v-if="usernameRegister">
|
|
11
|
+
t.link/{{username}} {{ssoLang[this.appLang].username_is_free}} ✅
|
|
12
|
+
<br>
|
|
13
|
+
|
|
14
|
+
</span>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<span v-if="emailLogin">
|
|
18
|
+
<div class="page-login-field half-top">
|
|
19
|
+
<i style="padding-top: 15px;">
|
|
20
|
+
<img src="https://cdn.tapni.co/icons/mail.png" class="responsive-image" style="width: 60%;">
|
|
21
|
+
</i>
|
|
22
|
+
<input v-model="email" @keydown.space.prevent type="email" :placeholder="ssoLang[this.appLang].email" name="email" required>
|
|
23
|
+
<em></em>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="page-login-field half-top">
|
|
26
|
+
<i style="padding-top: 15px">
|
|
27
|
+
<img src="https://cdn.tapni.co/icons/user.png" class="responsive-image" style="width: 50%;">
|
|
28
|
+
</i>
|
|
29
|
+
<input v-model="username" @keydown.space.prevent type="text"
|
|
30
|
+
autocorrect="off" autocapitalize="off" spellcheck="false"
|
|
31
|
+
:placeholder="ssoLang[this.appLang].username" name="username" required :disabled="usernameRegister"
|
|
32
|
+
:class="{'input-disabled': usernameRegister}"
|
|
33
|
+
>
|
|
34
|
+
<em></em>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="page-login-field half-top half-bottom">
|
|
37
|
+
<i style="padding-top: 15px">
|
|
38
|
+
<img src="https://cdn.tapni.co/icons/padlock.png" class="responsive-image" style="width: 50%;">
|
|
39
|
+
</i>
|
|
40
|
+
<input v-model="password" :type="revealPassword ? 'text' : 'password'" :placeholder="ssoLang[this.appLang].password" name="password" required minlength="8">
|
|
41
|
+
<em @click="revealPassword = !revealPassword" class="pointer">
|
|
42
|
+
<img v-show="!revealPassword" src="https://cdn.tapni.co/icons/reveal-password.png" class="responsive-image password-reveal-icon">
|
|
43
|
+
<img v-show="revealPassword" src="https://cdn.tapni.co/icons/hide-password.png" class="responsive-image password-reveal-icon">
|
|
44
|
+
</em>
|
|
45
|
+
</div>
|
|
46
|
+
<button type="submit" class="button black-button google-button bg-tapni-grey pointer button-90 button-center uppercase button-rounded bold full-top">
|
|
47
|
+
<span v-if="!submitted">{{formButtonText}}</span>
|
|
48
|
+
<span v-else class="button--loading button__loader"></span>
|
|
49
|
+
</button>
|
|
50
|
+
</span>
|
|
51
|
+
<div class="decoration decoration-lines-thin half-top half-bottom"></div>
|
|
52
|
+
|
|
53
|
+
<!-- Apple Login Button -->
|
|
54
|
+
<a @click="appleLogin" v-if="displayAppleLogin"
|
|
55
|
+
class="button-center button button-90 google-button pointer">
|
|
56
|
+
<img src="https://cdn.tapni.co/icons/apple-logo.png" style="position: absolute; margin-left: -11px; padding: 8px 0; height: 100%;"/>
|
|
57
|
+
<span v-if="!appleLoad"> {{ssoLang[this.appLang].sign_up_with}} Apple</span>
|
|
58
|
+
<span v-else class="button--loading button__loader"></span>
|
|
59
|
+
</a>
|
|
60
|
+
|
|
61
|
+
<!-- Google Login Button -->
|
|
62
|
+
<a @click="googleLogin"
|
|
63
|
+
class="button-center button button-90 google-button pointer ">
|
|
64
|
+
<img src="https://cdn.tapni.co/icons/g-logo.png" style="position: absolute; margin-left: -9px; padding: 8px 0; height: 100%;"/>
|
|
65
|
+
<span v-if="!googleLoad">{{ssoLang[this.appLang].sign_up_with}} Google</span>
|
|
66
|
+
<span v-else class="button--loading button__loader"></span>
|
|
67
|
+
</a>
|
|
68
|
+
|
|
69
|
+
<!-- Facebook Login Button -->
|
|
70
|
+
<a v-if="displayFacebookLogin"
|
|
71
|
+
@click="facebookLogin"
|
|
72
|
+
class="button-center button button-90 google-button pointer">
|
|
73
|
+
<img src="https://cdn.tapni.co/icons/facebook-blue.png" style="position: absolute; margin-left: -10px; padding: 10px 0; height: 100%;"/>
|
|
74
|
+
<span v-if="!facebookLoad">{{ssoLang[this.appLang].sign_up_with}} Facebook</span>
|
|
75
|
+
<span v-else class="button--loading button__loader"></span>
|
|
76
|
+
</a>
|
|
77
|
+
|
|
78
|
+
<!-- Email Login Button -->
|
|
79
|
+
<a @click="emailLogin = true" v-if="!emailLogin"
|
|
80
|
+
class="button-center button button-90 google-button pointer">
|
|
81
|
+
<img src="https://cdn.tapni.co/icons/mail.png" style="position: absolute; margin-left: -8px; padding: 12px 0; height: 100%;"/>
|
|
82
|
+
<span>{{ssoLang[this.appLang].sign_up_with}} Email</span>
|
|
83
|
+
</a>
|
|
84
|
+
|
|
85
|
+
<div class="decoration decoration-lines-thin no-bottom"></div>
|
|
86
|
+
|
|
87
|
+
<p class="close-text center-text half-top color-black">
|
|
88
|
+
{{ssoLang[this.appLang].terms_by_registering}} <br>
|
|
89
|
+
<a class="" href="https://tapni.co/policies/terms-of-service">{{ssoLang[this.appLang].terms_of_service}}</a> {{ssoLang[this.appLang].and}} <a href="https://tapni.co/policies/privacy-policy">{{ssoLang[this.appLang].privacy_policy}}</a>
|
|
90
|
+
</p>
|
|
91
|
+
<div class="decoration decoration-lines-thin no-bottom"></div>
|
|
92
|
+
<div v-if="!isModal" class="page-login-links">
|
|
93
|
+
<router-link class="create float-right" to="/verify">{{ssoLang[this.appLang].verify_account}}</router-link>
|
|
94
|
+
<router-link class="forgot float-left" to="/login">{{ssoLang[this.appLang].sign_in}}</router-link>
|
|
95
|
+
<div class="clear"></div>
|
|
96
|
+
</div>
|
|
97
|
+
<div v-else class="page-login-links" @click="loginAccountModal">
|
|
98
|
+
<a class="forgot center-text pointer small-top">{{ssoLang[this.appLang].or}} <br> {{ssoLang[this.appLang].sign_in_with_new}}</a>
|
|
99
|
+
<div class="clear"></div>
|
|
100
|
+
</div>
|
|
101
|
+
</form>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script>
|
|
105
|
+
import GoogleMixin from '../mixins/google.mixin'
|
|
106
|
+
import FacebookMixin from '../mixins/facebook.mixin'
|
|
107
|
+
import AppleMixin from '../mixins/apple.mixin'
|
|
108
|
+
import MicrosoftMixin from '../mixins/microsoft.mixin'
|
|
109
|
+
import {EventBus} from "../store/event-bus";
|
|
110
|
+
import AuthMixin from "../mixins/auth.mixin";
|
|
111
|
+
export default {
|
|
112
|
+
name: 'AuthRegister',
|
|
113
|
+
mixins: [GoogleMixin, FacebookMixin, AppleMixin, MicrosoftMixin, AuthMixin],
|
|
114
|
+
props: {
|
|
115
|
+
isModal: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
required: false,
|
|
118
|
+
default: false
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
data () {
|
|
122
|
+
return {
|
|
123
|
+
usernameRegister: false,
|
|
124
|
+
loading: true,
|
|
125
|
+
submitted: false,
|
|
126
|
+
formButtonText: 'REGISTER',
|
|
127
|
+
username: '',
|
|
128
|
+
email: '',
|
|
129
|
+
password: '',
|
|
130
|
+
revealPassword: false,
|
|
131
|
+
emailLogin: true,
|
|
132
|
+
invitationCode: '',
|
|
133
|
+
referral: ''
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
mounted () {
|
|
137
|
+
if (!this.isModal) {
|
|
138
|
+
if (this.isLoggedIn) {
|
|
139
|
+
this.$router.push(this.home)
|
|
140
|
+
} else if (!this.$route.query.state && !this.$route.query.oauth && !this.$route.params.oauth) {
|
|
141
|
+
EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
this.invitationCode = this.$route.query.ic || ''
|
|
145
|
+
|
|
146
|
+
// Username Registration for Link-In-Bio
|
|
147
|
+
if (this.$route.query.username) {
|
|
148
|
+
this.usernameRegister = true
|
|
149
|
+
this.emailLogin = true
|
|
150
|
+
this.username = this.$route.query.username
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Track Referrals from Query or Local Storage
|
|
154
|
+
if (this.$route.query.ref) {
|
|
155
|
+
this.referral = this.$route.query.ref
|
|
156
|
+
} else if (this.storage.referral) {
|
|
157
|
+
this.referral = this.storage.referral
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
methods: {
|
|
162
|
+
async submit() {
|
|
163
|
+
if (this.password.length < 8) return this.errorSnack(this.ssoLang[this.appLang].password_8_chars);
|
|
164
|
+
if (this.password.search(/[a-z]/) < 0) return this.errorSnack(this.ssoLang[this.appLang].password_least_one_lowercase);
|
|
165
|
+
if (this.password.search(/[A-Z]/) < 0) return this.errorSnack(this.ssoLang[this.appLang].password_least_one_uppercase);
|
|
166
|
+
if (this.password.search(/[0-9]/) < 0) return this.errorSnack(this.ssoLang[this.appLang].password_least_one_number);
|
|
167
|
+
|
|
168
|
+
if (this.submitted) return
|
|
169
|
+
this.submitted = true
|
|
170
|
+
|
|
171
|
+
this.email = this.email.trim()
|
|
172
|
+
this.username = this.username.trim()
|
|
173
|
+
|
|
174
|
+
let data = {
|
|
175
|
+
response_type: this.response_type,
|
|
176
|
+
email: this.email,
|
|
177
|
+
username: this.username,
|
|
178
|
+
password: this.password,
|
|
179
|
+
ic: this.invitationCode,
|
|
180
|
+
captchaToken: await this.getCaptchaToken('account_verify'),
|
|
181
|
+
ref: this.referral
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
let response = await this.register(data);
|
|
185
|
+
this.submitted = false
|
|
186
|
+
if (response.data && response.data.success) {
|
|
187
|
+
if (response.data.message === 'SUCCESS_REGISTER') {
|
|
188
|
+
if (this.isModal) EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModalVerify', data: false})
|
|
189
|
+
else this.$router.push('/verify')
|
|
190
|
+
this.successSnack(this.ssoLang[this.appLang].register_success);
|
|
191
|
+
this.formButtonText = this.ssoLang[this.appLang].check_your_inbox
|
|
192
|
+
} else if (response.data.message === 'SUCCESS_LOGIN') {
|
|
193
|
+
if (this.display === 'npm') {
|
|
194
|
+
await this.loginSetup({ ...response, isModal: data.isModal });
|
|
195
|
+
this.getLoggedInAccounts();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
await this.loginSuccess({ ...response, isModal: data.isModal });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
close () {
|
|
203
|
+
EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModal', data: true})
|
|
204
|
+
},
|
|
205
|
+
loginAccountModal () {
|
|
206
|
+
EventBus.$emit('ssoEvent', {name: 'toggleAddAccountModalLogin', data: false})
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
watch: {
|
|
210
|
+
email(nv) { this.storage.verifyEmail = nv },
|
|
211
|
+
referral(nv) { this.storage.referral = nv }
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
</style>
|