@everymatrix/general-player-login-form 1.44.0 → 1.45.0
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/components/GeneralPlayerLoginForm-DA7FHyqz.cjs +5 -0
- package/components/GeneralPlayerLoginForm-pQwOgSrr.js +5215 -0
- package/components/GeneralPlayerSmsVerificationForm-Fw_YaAcd.js +548 -0
- package/components/GeneralPlayerSmsVerificationForm-TUDKWMcp.cjs +1 -0
- package/es2015/general-player-login-form.cjs +1 -0
- package/es2015/general-player-login-form.js +16 -0
- package/package.json +17 -32
- package/CHANGELOG.md +0 -6
- package/README.md +0 -30
- package/dist/general-player-login-form.js +0 -2
- package/dist/general-player-login-form.js.map +0 -1
- package/index.html +0 -22
- package/index.js +0 -1
- package/public/favicon.png +0 -0
- package/public/reset.css +0 -48
- package/rollup.config.js +0 -67
- package/src/GeneralPlayerLoginForm.svelte +0 -612
- package/src/i18n.js +0 -27
- package/src/index.ts +0 -5
- package/src/translations.js +0 -132
- package/stories/GeneralPlayerLoginForm.stories.js +0 -13
- package/tsconfig.json +0 -6
|
@@ -1,612 +0,0 @@
|
|
|
1
|
-
<svelte:options tag={null} />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { onMount } from "svelte";
|
|
5
|
-
import { isMobile } from 'rvhelper';
|
|
6
|
-
|
|
7
|
-
import '@everymatrix/general-player-sms-verification-form';
|
|
8
|
-
|
|
9
|
-
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
10
|
-
import { TRANSLATIONS } from './translations';
|
|
11
|
-
|
|
12
|
-
export let endpoint:string = '';
|
|
13
|
-
export let captchakey:string = '';
|
|
14
|
-
export let lang:string = 'en';
|
|
15
|
-
export let smsverification = 'false';
|
|
16
|
-
export let simplepasswordvalidation:string = 'false';
|
|
17
|
-
export let clientstyling:string = '';
|
|
18
|
-
export let clientstylingurl:string = '';
|
|
19
|
-
export let translationurl:string = '';
|
|
20
|
-
export let savecredentials:string = '';
|
|
21
|
-
|
|
22
|
-
let playerId;
|
|
23
|
-
let smsTokenId;
|
|
24
|
-
let smsTemplate: string = 'Please use this code {0} to activate your account';
|
|
25
|
-
let smsSendApiFailed = false;
|
|
26
|
-
let number;
|
|
27
|
-
let mobileView:boolean = false;
|
|
28
|
-
let userAgent:string = window.navigator.userAgent;
|
|
29
|
-
let userValue:string = '';
|
|
30
|
-
let userPassword:string = '';
|
|
31
|
-
// @TODO Typescript type model for loginFormData
|
|
32
|
-
let loginFormData:any = {
|
|
33
|
-
username: '',
|
|
34
|
-
password: ''
|
|
35
|
-
}
|
|
36
|
-
let invalidName:boolean = false;
|
|
37
|
-
let invalidPassword:boolean = false;
|
|
38
|
-
|
|
39
|
-
let errorMessage:string = '';
|
|
40
|
-
|
|
41
|
-
let isLoading:boolean = false;
|
|
42
|
-
let passwordVisibilityToggle:HTMLElement;
|
|
43
|
-
let isPasswordVisible:boolean = false;
|
|
44
|
-
let isFormDataInvalid:boolean = true;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let customStylingContainer:HTMLElement;
|
|
50
|
-
let displayNone:boolean = false;
|
|
51
|
-
let setTimer = +localStorage.getItem('smsTimer') || 0;
|
|
52
|
-
let currentTimer = Date.now() / 1000 - setTimer;
|
|
53
|
-
let startSmsValidation = localStorage.getItem('smsValidation') == 'true' && currentTimer < 60 ? true : false;
|
|
54
|
-
|
|
55
|
-
let regexValidators = {
|
|
56
|
-
user: /^(?!(?:.*\d){9})(?=(?:.*[a-zA-Z]){4})^[a-zA-Z\d]*$/,
|
|
57
|
-
email: /^[^<>()*{}=/|?`~[\]\\,;:\%#^\s@\"$&!@]+@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}))$/i,
|
|
58
|
-
password: /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[^\w\s]).{8,20}$/
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
setupI18n({ withLocale: 'en', translations: {}});
|
|
62
|
-
|
|
63
|
-
const setTranslationUrl = ():void => {
|
|
64
|
-
let url:string = translationurl;
|
|
65
|
-
|
|
66
|
-
fetch(url).then((res:any) => res.json())
|
|
67
|
-
.then((res) => {
|
|
68
|
-
Object.keys(res).forEach((item:any):void => {
|
|
69
|
-
addNewMessages(item, res[item]);
|
|
70
|
-
});
|
|
71
|
-
}).catch((err:any) => {
|
|
72
|
-
console.log(err);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
Object.keys(TRANSLATIONS).forEach((item:any) => {
|
|
77
|
-
addNewMessages(item, TRANSLATIONS[item]);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const doRecaptcha = ():Promise<string> => {
|
|
81
|
-
return new Promise((resolve, reject) => {
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
grecaptcha.ready(() => {
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
grecaptcha.execute(captchakey, { action: "submit" })
|
|
86
|
-
.then((token:string) => {
|
|
87
|
-
resolve(token);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const verifyTypeOfPassword = ():void => {
|
|
94
|
-
if (simplepasswordvalidation == 'true') {
|
|
95
|
-
regexValidators.password = /^(?!.* ).{8,20}$/;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const showPassword = ():void => {
|
|
100
|
-
isPasswordVisible = true;
|
|
101
|
-
togglePasswordVisibility();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const hidePassword = ():void => {
|
|
105
|
-
isPasswordVisible = false;
|
|
106
|
-
togglePasswordVisibility();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const togglePasswordVisibility = ():void => {
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
passwordVisibilityToggle.type = isPasswordVisible ? "text" : "password";
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const switchToRegister = ():void => {
|
|
115
|
-
window.postMessage({ type: "ToRegister" }, window.location.href);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const switchToForgotPassword = (e):void => {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
window.postMessage({ type: "NavForgotPassword" }, window.location.href);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const submitLoginForm = (e?):void => {
|
|
124
|
-
e?.preventDefault();
|
|
125
|
-
doRecaptcha()
|
|
126
|
-
.then((token:string) => {
|
|
127
|
-
if (checkUserIdentifier(userValue) && checkUserPassword(userPassword)) {
|
|
128
|
-
loginFormData = {
|
|
129
|
-
username: userValue,
|
|
130
|
-
password: userPassword,
|
|
131
|
-
token: token
|
|
132
|
-
};
|
|
133
|
-
isLoading = true;
|
|
134
|
-
userLogin(loginFormData);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const checkUserIdentifier = (user:string):boolean => {
|
|
140
|
-
if ((regexValidators.user.test(user) || regexValidators.email.test(user)) && user.length <= 100) {
|
|
141
|
-
return true;
|
|
142
|
-
} else {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const checkUserPassword = (password:string):boolean => {
|
|
148
|
-
if (regexValidators.password.test(password)) {
|
|
149
|
-
return true;
|
|
150
|
-
} else {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const validateUserName = ():void => {
|
|
156
|
-
invalidName = !checkUserIdentifier(userValue);
|
|
157
|
-
isFormDataInvalid = (!invalidName && !invalidPassword && userPassword) ? false : true;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const validatePassword = ():void => {
|
|
161
|
-
invalidPassword = !checkUserPassword(userPassword);
|
|
162
|
-
isFormDataInvalid = (!invalidName && !invalidPassword && userValue) ? false : true;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const messageHandler = (e:MessageEvent):void => {
|
|
166
|
-
if (e.data) {
|
|
167
|
-
switch (e.data.type) {
|
|
168
|
-
case 'ModalLoader':
|
|
169
|
-
isLoading = false;
|
|
170
|
-
break;
|
|
171
|
-
|
|
172
|
-
case 'UserSessionID':
|
|
173
|
-
isLoading = false;
|
|
174
|
-
break;
|
|
175
|
-
|
|
176
|
-
case 'SmsHasBeenValidated':
|
|
177
|
-
submitLoginForm();
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const handlePostLogin = (loginData):void => {
|
|
184
|
-
//Analytics event
|
|
185
|
-
if(typeof gtag == 'function'){
|
|
186
|
-
gtag('event', 'Login', {
|
|
187
|
-
'context': 'GeneralPlayerLoginRegisterPage'
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const userLogin = async ({username, password, token}):Promise<any> => {
|
|
193
|
-
let headers = {
|
|
194
|
-
'Content-Type': 'application/json',
|
|
195
|
-
'g-recaptcha-response': token
|
|
196
|
-
};
|
|
197
|
-
let bodyData = {
|
|
198
|
-
username,
|
|
199
|
-
password
|
|
200
|
-
};
|
|
201
|
-
let options = {
|
|
202
|
-
method: 'POST',
|
|
203
|
-
headers,
|
|
204
|
-
body: JSON.stringify(bodyData),
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
fetch(`${endpoint}/v1/player/login/player`, options)
|
|
208
|
-
.then((res:any) => {
|
|
209
|
-
if (res.status >= 500) {
|
|
210
|
-
errorMessage = "Server might not be responsing";
|
|
211
|
-
isLoading = false;
|
|
212
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
213
|
-
type: 'error',
|
|
214
|
-
message: "Server might not be responding"
|
|
215
|
-
}}, window.location.href)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return res.json();
|
|
219
|
-
}).then((data:any):void => {
|
|
220
|
-
|
|
221
|
-
if ( data.actions !== undefined ) {
|
|
222
|
-
window.postMessage({ type: 'PlayerActions' }, window.location.href);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if(smsverification === 'true' && data.code === 4) {
|
|
226
|
-
playerId = data.detail.userId;
|
|
227
|
-
number = data.detail.phonePrefix + data.detail.phone;
|
|
228
|
-
startSmsValidation = true;
|
|
229
|
-
sendSmsToken(number, playerId);
|
|
230
|
-
localStorage.setItem('smsValidation', 'true');
|
|
231
|
-
localStorage.setItem('playerData', JSON.stringify({playerid: playerId, number: number}));
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (data.sessionID) {
|
|
235
|
-
window.postMessage({ type: 'UserSessionID', session: data.sessionID, userid: data.universalID }, window.location.href);
|
|
236
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
237
|
-
type: 'success',
|
|
238
|
-
message: $_('successMessage')
|
|
239
|
-
}}, window.location.href);
|
|
240
|
-
|
|
241
|
-
if (window.PasswordCredential && savecredentials == 'true') {
|
|
242
|
-
const credentials = new PasswordCredential({
|
|
243
|
-
password: bodyData.password,
|
|
244
|
-
id: bodyData.username
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
navigator.credentials.store(credentials);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
handlePostLogin(bodyData);
|
|
251
|
-
} else {
|
|
252
|
-
// Parsing GMCore message 'cuz it's stupid and it doesn't know how to send error messages in 2021 ffs
|
|
253
|
-
// LE: 2022 and still the same fuckin' GMCore response ... GMCore 1.5 is launched, GMCore 2.0 is coming probably a few years after Diablo IV.
|
|
254
|
-
// LLE: july 2023, Diablo IV just came out, GMCore 2.0 not. Elder Scrolls VI?
|
|
255
|
-
try {
|
|
256
|
-
let error = data.error;
|
|
257
|
-
errorMessage = error;
|
|
258
|
-
isLoading = false;
|
|
259
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
260
|
-
type: 'error',
|
|
261
|
-
message: error
|
|
262
|
-
}}, window.location.href)
|
|
263
|
-
} catch (e) {
|
|
264
|
-
let error = data.error.substring(data.error.indexOf('errorMessage') + 13, data.error.length);
|
|
265
|
-
errorMessage = error;
|
|
266
|
-
isLoading = false;
|
|
267
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
268
|
-
type: 'error',
|
|
269
|
-
message: error
|
|
270
|
-
}}, window.location.href)
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const sendSmsToken = async (number, playerId) => {
|
|
277
|
-
localStorage.setItem('smsTimer', JSON.stringify(Math.floor(Date.now() / 1000)));
|
|
278
|
-
try {
|
|
279
|
-
const res = await fetch(`${endpoint}/v1/player/sms/token`,{
|
|
280
|
-
method: 'POST',
|
|
281
|
-
headers: {
|
|
282
|
-
'Content-Type': 'application/json',
|
|
283
|
-
accept: 'application/json',
|
|
284
|
-
},
|
|
285
|
-
body: JSON.stringify(
|
|
286
|
-
{
|
|
287
|
-
userId: playerId,
|
|
288
|
-
messageTemplate: smsTemplate,
|
|
289
|
-
destination: number,
|
|
290
|
-
}
|
|
291
|
-
),
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const data = await res.json();
|
|
295
|
-
|
|
296
|
-
if (res.ok ) {
|
|
297
|
-
smsTokenId = data.id;
|
|
298
|
-
let smsMaxValidations = data.maxValidationAttempts;
|
|
299
|
-
smsSendApiFailed = false;
|
|
300
|
-
} else {
|
|
301
|
-
smsSendApiFailed = true;
|
|
302
|
-
throw new Error("Failed to fetch");
|
|
303
|
-
}
|
|
304
|
-
} catch(err) {
|
|
305
|
-
smsSendApiFailed = true;
|
|
306
|
-
console.error(err);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const initialLoad = ():void => {
|
|
311
|
-
setLocale(lang);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const setClientStyling = ():void => {
|
|
315
|
-
let sheet = document.createElement('style');
|
|
316
|
-
sheet.innerHTML = clientstyling;
|
|
317
|
-
customStylingContainer.appendChild(sheet);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const setClientStylingURL = ():void => {
|
|
321
|
-
displayNone = true;
|
|
322
|
-
|
|
323
|
-
let url:URL = new URL(clientstylingurl);
|
|
324
|
-
let cssFile:HTMLElement = document.createElement('style');
|
|
325
|
-
|
|
326
|
-
fetch(url.href)
|
|
327
|
-
.then((res:any) => res.text())
|
|
328
|
-
.then((data:any) => {
|
|
329
|
-
cssFile.innerHTML = data
|
|
330
|
-
|
|
331
|
-
setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
|
|
332
|
-
setTimeout(() => { displayNone = false; }, 500);
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
onMount(() => {
|
|
337
|
-
window.addEventListener("message", messageHandler, false);
|
|
338
|
-
window.postMessage({ type: "LoginRegisterModalActive" }, window.location.href);
|
|
339
|
-
|
|
340
|
-
mobileView = isMobile(userAgent);
|
|
341
|
-
|
|
342
|
-
return () => {
|
|
343
|
-
window.removeEventListener('message', messageHandler);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
$: endpoint && lang && initialLoad();
|
|
348
|
-
$: simplepasswordvalidation && verifyTypeOfPassword();
|
|
349
|
-
$: clientstyling && customStylingContainer && setClientStyling();
|
|
350
|
-
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
351
|
-
$: translationurl && setTranslationUrl();
|
|
352
|
-
</script>
|
|
353
|
-
|
|
354
|
-
<svelte:head>
|
|
355
|
-
{#if captchakey}
|
|
356
|
-
<script src="//www.google.com/recaptcha/api.js?render={captchakey}" async defer></script>
|
|
357
|
-
{/if}
|
|
358
|
-
</svelte:head>
|
|
359
|
-
|
|
360
|
-
<div class="g-recaptcha" data-sitekey="{captchakey}" />
|
|
361
|
-
|
|
362
|
-
<div class="PlayerLoginFormWrapper" bind:this={customStylingContainer}>
|
|
363
|
-
{#if isLoading}
|
|
364
|
-
<div class="ModalLoaderWrapper">
|
|
365
|
-
<div class="ModalLoader"></div>
|
|
366
|
-
</div>
|
|
367
|
-
{:else}
|
|
368
|
-
<div class="FormContainer {mobileView ? 'FormMobileContainer' : ''}">
|
|
369
|
-
<div class="FormLogin">
|
|
370
|
-
{#if startSmsValidation}
|
|
371
|
-
<general-player-sms-verification-form
|
|
372
|
-
{endpoint}
|
|
373
|
-
{number}
|
|
374
|
-
{clientstyling}
|
|
375
|
-
{clientstylingurl}
|
|
376
|
-
playerid={playerId}
|
|
377
|
-
tokenid={smsTokenId}>
|
|
378
|
-
</general-player-sms-verification-form>
|
|
379
|
-
{:else}
|
|
380
|
-
<div class="FormHeader">
|
|
381
|
-
<h4 class="FormHeaderTitle">{$_('loginTitle')}</h4>
|
|
382
|
-
<p class="FormHeaderSubtitle">{$_('loginSubtitle')} <span class="FormRegisterCallToAction" on:click={() => switchToRegister()}>{$_('loginSubtitleRegister')}</span></p>
|
|
383
|
-
</div>
|
|
384
|
-
<div class="FormContent">
|
|
385
|
-
<form id="signin" >
|
|
386
|
-
<div class="UserContainer {invalidName ? 'InvalidField' : ''}">
|
|
387
|
-
<label for="username">{$_('loginUsername')}:<span class="FormRequired">*</span></label>
|
|
388
|
-
<input bind:value={userValue} on:input={validateUserName} type="text" id="email" name="email" autocapitalize="none" autocomplete={savecredentials ? "username email" : "off"} required/>
|
|
389
|
-
{#if invalidName}
|
|
390
|
-
<p class="InvalidInput">{$_('loginUsernameError')}</p>
|
|
391
|
-
{/if}
|
|
392
|
-
</div>
|
|
393
|
-
<div class="PasswordContainer {invalidPassword ? 'InvalidField' : ''}">
|
|
394
|
-
<label for="current-password">{$_('loginPassword')}:<span class="FormRequired">*</span></label>
|
|
395
|
-
<input bind:value={userPassword} on:input={validatePassword} type="password" name="current-password" id="current-password" autocapitalize="none" bind:this={passwordVisibilityToggle} autocomplete={savecredentials ? "current-password" : "off"} aria-describedby="password-constraints" required/>
|
|
396
|
-
{#if isPasswordVisible}
|
|
397
|
-
<svg on:click={() => hidePassword()} class="TogglePasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.844" height="12.887" viewBox="0 0 18.844 12.887"><defs><style>.a{fill:var(--emfe-w-registration-typography, var(--emfe-w-color-background, #07072A));}</style></defs><g transform="translate(-110.856 -23.242)"><circle class="a" cx="0.05" cy="0.05" r="0.05" transform="translate(121.017 31.148)"/><g transform="translate(117.499 27.37)"><path class="a" d="M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z" transform="translate(-142.164 -39.123)"/><path class="a" d="M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z" transform="translate(-136.413 -42.068)"/></g><g transform="translate(110.856 24.899)"><path class="a" d="M122.538,42.061a7.043,7.043,0,0,1-2.325.53,10.373,10.373,0,0,1-4.393-1.482,36.509,36.509,0,0,1-3.873-2.391.13.13,0,0,1,0-.208,44.141,44.141,0,0,1,3.873-2.651c.394-.233.768-.437,1.13-.622l-.686-.838c-.322.167-.651.347-.99.55a37.989,37.989,0,0,0-3.977,2.729,1.21,1.21,0,0,0-.442.962,1.1,1.1,0,0,0,.494.936,34.416,34.416,0,0,0,3.977,2.469,11.468,11.468,0,0,0,4.886,1.611,8.427,8.427,0,0,0,3.039-.725Z" transform="translate(-110.856 -33.157)"/><path class="a" d="M149.119,34.14a45.875,45.875,0,0,0-4.055-2.729,20.541,20.541,0,0,0-2.547-1.248,5.6,5.6,0,0,0-4.79-.017l.7.856a5.254,5.254,0,0,1,1.672-.346,10.072,10.072,0,0,1,4.445,1.663,34.132,34.132,0,0,1,3.925,2.651.13.13,0,0,1,0,.208,40.2,40.2,0,0,1-3.925,2.391c-.179.092-.352.176-.525.26l.684.835c.1-.054.2-.1.309-.159a36.356,36.356,0,0,0,4.055-2.469,1.067,1.067,0,0,0,.52-.936A1.159,1.159,0,0,0,149.119,34.14Z" transform="translate(-130.743 -29.617)"/></g><rect class="a" width="0.972" height="15.861" rx="0.486" transform="translate(114.827 23.858) rotate(-39.315)"/></g></svg>
|
|
398
|
-
{:else}
|
|
399
|
-
<svg on:click={() => showPassword()} class="TogglePasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.843" height="10.5" viewBox="0 0 18.843 10.5"><defs><style>.a{fill:var(--emfe-w-registration-typography, var(--emfe-w-color-background, #07072A));}</style></defs><g transform="translate(-14.185 -27.832)"><path class="a" d="M23.541,38.332a11.467,11.467,0,0,1-4.886-1.611,34.413,34.413,0,0,1-3.976-2.469,1.1,1.1,0,0,1-.494-.936,1.21,1.21,0,0,1,.442-.962A37.986,37.986,0,0,1,18.6,29.625a16.06,16.06,0,0,1,2.521-1.248,6.862,6.862,0,0,1,2.417-.546,6.862,6.862,0,0,1,2.417.546,20.541,20.541,0,0,1,2.547,1.248,45.872,45.872,0,0,1,4.054,2.729,1.159,1.159,0,0,1,.468.962,1.067,1.067,0,0,1-.52.936,36.353,36.353,0,0,1-4.054,2.469A11.2,11.2,0,0,1,23.541,38.332Zm0-9.46a9.813,9.813,0,0,0-4.392,1.663,44.138,44.138,0,0,0-3.873,2.651.13.13,0,0,0,0,.208,36.5,36.5,0,0,0,3.873,2.391,10.372,10.372,0,0,0,4.392,1.481,11.051,11.051,0,0,0,4.444-1.481,40.2,40.2,0,0,0,3.925-2.391.13.13,0,0,0,0-.208h0a34.132,34.132,0,0,0-3.925-2.651A10.072,10.072,0,0,0,23.541,28.872Z" transform="translate(0)"/><circle class="a" cx="2.779" cy="2.779" r="2.779" transform="translate(20.827 30.303)"/></g></svg>
|
|
400
|
-
{/if}
|
|
401
|
-
{#if invalidPassword && simplepasswordvalidation !== 'true'}
|
|
402
|
-
<p class="InvalidInput">{$_('loginPasswordError')}</p>
|
|
403
|
-
{/if}
|
|
404
|
-
{#if invalidPassword && simplepasswordvalidation === 'true'}
|
|
405
|
-
<p class="InvalidInput">{$_('loginSimplePasswordError')}</p>
|
|
406
|
-
{/if}
|
|
407
|
-
</div>
|
|
408
|
-
{#if errorMessage}
|
|
409
|
-
<p class="ErrorMessage">{errorMessage}</p>
|
|
410
|
-
{/if}
|
|
411
|
-
<button class="SignInButton" on:click={(e) => submitLoginForm(e)} disabled={isFormDataInvalid} id="signin-button">{$_('loginButton')}</button>
|
|
412
|
-
<button class="ForgotPasswordButton" on:click={(e) => switchToForgotPassword(e)}>{$_('loginForgotPassword')}</button>
|
|
413
|
-
</form>
|
|
414
|
-
</div>
|
|
415
|
-
{/if}
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
{/if}
|
|
419
|
-
</div>
|
|
420
|
-
|
|
421
|
-
<style lang="scss">
|
|
422
|
-
.grecaptcha-badge { opacity:0;}
|
|
423
|
-
|
|
424
|
-
.PlayerLoginFormWrapper {
|
|
425
|
-
height: 100%;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.FormContainer {
|
|
429
|
-
width: 100%;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.FormLogin {
|
|
433
|
-
background: var(--emfe-w-registration-color-bg, var(--emfe-w-color-gray-50, #F9F8F8));
|
|
434
|
-
padding: 50px;
|
|
435
|
-
}
|
|
436
|
-
.FormHeaderTitle {
|
|
437
|
-
color: var(--emfe-w-registration-typography, var(--emfe-w-color-contrast, #07072A));
|
|
438
|
-
font-size: 20px;
|
|
439
|
-
font-weight: 300;
|
|
440
|
-
padding: 0;
|
|
441
|
-
text-transform: uppercase;
|
|
442
|
-
margin: 0;
|
|
443
|
-
}
|
|
444
|
-
.PasswordContainer {
|
|
445
|
-
position: relative;
|
|
446
|
-
}
|
|
447
|
-
.FormRequired {
|
|
448
|
-
color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));
|
|
449
|
-
}
|
|
450
|
-
.FormHeaderSubtitle {
|
|
451
|
-
color: var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));
|
|
452
|
-
font-size: 14px;
|
|
453
|
-
font-weight: 300;
|
|
454
|
-
margin: 5px 0 0 0;
|
|
455
|
-
}
|
|
456
|
-
.FormRegisterCallToAction {
|
|
457
|
-
color: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
458
|
-
font-size: 14px;
|
|
459
|
-
font-weight: 400;
|
|
460
|
-
text-decoration: none;
|
|
461
|
-
cursor: pointer;
|
|
462
|
-
}
|
|
463
|
-
.FormContent {
|
|
464
|
-
padding-top: 20px;
|
|
465
|
-
}
|
|
466
|
-
.UserContainer, .PasswordContainer, .CaptchaContainer {
|
|
467
|
-
color: var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));
|
|
468
|
-
display: flex;
|
|
469
|
-
flex-direction: column;
|
|
470
|
-
position: relative;
|
|
471
|
-
label {
|
|
472
|
-
font-size: 14px;
|
|
473
|
-
font-weight: 300;
|
|
474
|
-
padding-bottom: 5px;
|
|
475
|
-
}
|
|
476
|
-
input {
|
|
477
|
-
width: 100%;
|
|
478
|
-
height: 44px;
|
|
479
|
-
border: 1px solid var(--emfe-w-color-gray-100, #E6E6E6);
|
|
480
|
-
border-radius: 5px;
|
|
481
|
-
box-sizing:border-box;
|
|
482
|
-
padding: 5px 15px;
|
|
483
|
-
font-size: 16px;
|
|
484
|
-
line-height: 18px;
|
|
485
|
-
}
|
|
486
|
-
&.InvalidField {
|
|
487
|
-
input {
|
|
488
|
-
border: 1px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
489
|
-
background: var(--emfe-w-color-pale, #FBECF4);
|
|
490
|
-
color: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
.PasswordContainer input {
|
|
497
|
-
padding: 5px 30px 5px 15px;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.TogglePasswordVisibility {
|
|
501
|
-
height: 13px;
|
|
502
|
-
position: absolute;
|
|
503
|
-
right: 8px;
|
|
504
|
-
bottom: 55px;
|
|
505
|
-
&.InvalidToggle {
|
|
506
|
-
path, circle, rect {
|
|
507
|
-
fill: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
path, circle, rect {
|
|
511
|
-
fill: var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
.SignInButton {
|
|
515
|
-
color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
|
|
516
|
-
background: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
517
|
-
border: 1px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
518
|
-
border-radius: 5px;
|
|
519
|
-
width: 100%;
|
|
520
|
-
height: 60px;
|
|
521
|
-
padding: 0;
|
|
522
|
-
text-transform: uppercase;
|
|
523
|
-
font-size: 18px;
|
|
524
|
-
cursor: pointer;
|
|
525
|
-
&[disabled] {
|
|
526
|
-
background: var(--emfe-w-color-gray-100, #E6E6E6);
|
|
527
|
-
border: 1px solid var(--emfe-w-color-gray-150, #828282);
|
|
528
|
-
cursor: not-allowed;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
.ForgotPasswordButton {
|
|
532
|
-
border: 0;
|
|
533
|
-
background: transparent;
|
|
534
|
-
font-size: 14px;
|
|
535
|
-
font-weight: 300;
|
|
536
|
-
color: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
537
|
-
margin-top: 15px;
|
|
538
|
-
cursor: pointer;
|
|
539
|
-
}
|
|
540
|
-
.PasswordContainer, .UserContainer {
|
|
541
|
-
padding-bottom: 40px;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
.InvalidInput {
|
|
545
|
-
color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));
|
|
546
|
-
font-size: 10px;
|
|
547
|
-
position: absolute;
|
|
548
|
-
top: 55px;
|
|
549
|
-
padding-top: 5px;
|
|
550
|
-
line-height: 10px;
|
|
551
|
-
}
|
|
552
|
-
.ErrorMessage {
|
|
553
|
-
margin: 0 0 15px 0;
|
|
554
|
-
font-size: 12px;
|
|
555
|
-
color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));
|
|
556
|
-
}
|
|
557
|
-
.FormMobileContainer {
|
|
558
|
-
height:100%;
|
|
559
|
-
.FormLogin {
|
|
560
|
-
padding: 40px 20px;
|
|
561
|
-
}
|
|
562
|
-
.SignInButton,
|
|
563
|
-
.UserContainer input,
|
|
564
|
-
.PasswordContainer input,
|
|
565
|
-
.CaptchaContainer {
|
|
566
|
-
max-width: unset;
|
|
567
|
-
}
|
|
568
|
-
// .SuccessMessageContainer {
|
|
569
|
-
// margin: 0;
|
|
570
|
-
// height: 100%;
|
|
571
|
-
// }
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
.ModalLoaderWrapper {
|
|
575
|
-
display: flex;
|
|
576
|
-
height: 100%;
|
|
577
|
-
align-items: center;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
.ModalLoader {
|
|
581
|
-
display: block;
|
|
582
|
-
width: 80px;
|
|
583
|
-
height: 80px;
|
|
584
|
-
margin: 0 auto
|
|
585
|
-
}
|
|
586
|
-
.ModalLoader:after {
|
|
587
|
-
content: " ";
|
|
588
|
-
display: block;
|
|
589
|
-
width: 64px;
|
|
590
|
-
height: 64px;
|
|
591
|
-
margin: 8px;
|
|
592
|
-
border-radius: 50%;
|
|
593
|
-
border: 6px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));
|
|
594
|
-
border-color: var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C)) transparent var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C)) transparent;
|
|
595
|
-
animation: Loader 1.2s linear infinite;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/* MS Edge */
|
|
599
|
-
input::-ms-reveal,
|
|
600
|
-
input::-ms-clear {
|
|
601
|
-
display: none;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
@keyframes Loader {
|
|
605
|
-
0% {
|
|
606
|
-
transform: rotate(0deg);
|
|
607
|
-
}
|
|
608
|
-
100% {
|
|
609
|
-
transform: rotate(360deg);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
</style>
|
package/src/i18n.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
dictionary,
|
|
3
|
-
locale,
|
|
4
|
-
addMessages,
|
|
5
|
-
_
|
|
6
|
-
} from 'svelte-i18n';
|
|
7
|
-
|
|
8
|
-
function setupI18n({ withLocale: _locale, translations }) {
|
|
9
|
-
locale.subscribe((data) => {
|
|
10
|
-
if (data == null) {
|
|
11
|
-
dictionary.set(translations);
|
|
12
|
-
locale.set(_locale);
|
|
13
|
-
}
|
|
14
|
-
}); // maybe we will need this to make sure that the i18n is set up only once
|
|
15
|
-
/*dictionary.set(translations);
|
|
16
|
-
locale.set(_locale);*/
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function addNewMessages(lang, dict) {
|
|
20
|
-
addMessages(lang, dict);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function setLocale(_locale) {
|
|
24
|
-
locale.set(_locale);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { _, setupI18n, addNewMessages, setLocale };
|
package/src/index.ts
DELETED