@everymatrix/general-player-login-form 0.0.217 → 0.0.221
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/general-player-login-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.221",
|
|
4
4
|
"main": "dist/general-player-login-form.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "015e13b1638624ecac8f0cc2a0f210cbbac4910e"
|
|
40
40
|
}
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { onMount } from "svelte";
|
|
5
5
|
import { isMobile } from 'rvhelper';
|
|
6
|
+
|
|
7
|
+
// Native bridge
|
|
8
|
+
import { isNative, call as callNative, registerEventListener as registerNativeEventListener } from 'js-native-bridge';
|
|
9
|
+
|
|
6
10
|
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
7
11
|
import { LoginForm } from './translations';
|
|
8
12
|
|
|
9
|
-
import {
|
|
10
|
-
isNative,
|
|
11
|
-
call as callNative,
|
|
12
|
-
registerEventListener as registerNativeEventListener,
|
|
13
|
-
} from 'js-native-bridge';
|
|
14
|
-
|
|
15
13
|
export let imagedesktop:string = '';
|
|
16
14
|
export let captchakey:string = '';
|
|
17
15
|
export let lang:string = '';
|
|
@@ -20,6 +18,7 @@
|
|
|
20
18
|
let userAgent:string = window.navigator.userAgent;
|
|
21
19
|
let userValue:string = '';
|
|
22
20
|
let userPassword:string = '';
|
|
21
|
+
// @TODO Typescript type model for loginFormData
|
|
23
22
|
let loginFormData:any = {
|
|
24
23
|
username: '',
|
|
25
24
|
password: ''
|
|
@@ -34,8 +33,9 @@
|
|
|
34
33
|
let isPasswordVisible:boolean = false;
|
|
35
34
|
let isFormDataInvalid:boolean = true;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
let
|
|
36
|
+
// Native bridge
|
|
37
|
+
let isOnNative:boolean = false;
|
|
38
|
+
let waitingForCredentials:boolean = false;
|
|
39
39
|
|
|
40
40
|
let nativeCredentials:any = {};
|
|
41
41
|
|
|
@@ -148,14 +148,17 @@
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
const initialLoad = () => {
|
|
151
|
+
const initialLoad = ():void => {
|
|
152
152
|
setLocale(lang);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
onMount(async () => {
|
|
156
|
-
window.addEventListener(
|
|
156
|
+
window.addEventListener("message", messageHandler, false);
|
|
157
157
|
window.postMessage({ type: "LoginRegisterModalActive" }, window.location.href);
|
|
158
158
|
|
|
159
|
+
isOnNative = !!isNative(userAgent);
|
|
160
|
+
waitingForCredentials = isOnNative;
|
|
161
|
+
|
|
159
162
|
if (isOnNative) {
|
|
160
163
|
registerNativeEventListener(
|
|
161
164
|
'GET_CREDENTIALS',
|
|
@@ -209,32 +212,36 @@
|
|
|
209
212
|
<h4 class="FormHeaderTitle">{$_('loginForm.loginTitle')}</h4>
|
|
210
213
|
<p class="FormHeaderSubtitle">{$_('loginForm.loginSubtitle')} <span class="FormRegisterCallToAction" on:click={() => switchToRegister()}>{$_('loginForm.loginSubtitleRegister')}</span></p>
|
|
211
214
|
</div>
|
|
212
|
-
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
{
|
|
217
|
-
<
|
|
215
|
+
{#if waitingForCredentials}
|
|
216
|
+
<p>Waiting for credentials</p>
|
|
217
|
+
{:else}
|
|
218
|
+
<div class="FormContent">
|
|
219
|
+
<div class="UserContainer {invalidName ? 'InvalidField' : ''}">
|
|
220
|
+
<label for="UserName">{$_('loginForm.loginUsername')}:<span class="FormRequired">*</span></label>
|
|
221
|
+
<input bind:value={userValue} on:keyup={validateUserName} type="text" id="UserName" />
|
|
222
|
+
{#if invalidName}
|
|
223
|
+
<p class="InvalidInput">{$_('loginForm.loginUsernameError')}</p>
|
|
224
|
+
{/if}
|
|
225
|
+
</div>
|
|
226
|
+
<div class="PasswordContainer {invalidPassword ? 'InvalidField' : ''}">
|
|
227
|
+
<label for="Password">{$_('loginForm.loginPassword')}:<span class="FormRequired">*</span></label>
|
|
228
|
+
<input bind:value={userPassword} on:keyup={validatePassword} type="password" id="Password" bind:this={passwordVisibilityToggle} />
|
|
229
|
+
{#if isPasswordVisible}
|
|
230
|
+
<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:#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>
|
|
231
|
+
{:else}
|
|
232
|
+
<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:#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>
|
|
233
|
+
{/if}
|
|
234
|
+
{#if invalidPassword}
|
|
235
|
+
<p class="InvalidInput">{$_('loginForm.loginPasswordError')}</p>
|
|
236
|
+
{/if}
|
|
237
|
+
</div>
|
|
238
|
+
{#if errorMessage}
|
|
239
|
+
<p class="ErrorMessage">{errorMessage}</p>
|
|
218
240
|
{/if}
|
|
241
|
+
<button class="SignInButton" on:click={() => submitLoginForm()} disabled={isFormDataInvalid}>{$_('loginForm.loginButton')}</button>
|
|
242
|
+
<button class="ForgotPasswordButton" on:click={() => switchToForgotPassword()}>{$_('loginForm.loginForgotPassword')}</button>
|
|
219
243
|
</div>
|
|
220
|
-
|
|
221
|
-
<label for="Password">{$_('loginForm.loginPassword')}:<span class="FormRequired">*</span></label>
|
|
222
|
-
<input bind:value={userPassword} on:keyup={validatePassword} type="password" id="Password" bind:this={passwordVisibilityToggle} />
|
|
223
|
-
{#if isPasswordVisible}
|
|
224
|
-
<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:#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>
|
|
225
|
-
{:else}
|
|
226
|
-
<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:#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>
|
|
227
|
-
{/if}
|
|
228
|
-
{#if invalidPassword}
|
|
229
|
-
<p class="InvalidInput">{$_('loginForm.loginPasswordError')}</p>
|
|
230
|
-
{/if}
|
|
231
|
-
</div>
|
|
232
|
-
{#if errorMessage}
|
|
233
|
-
<p class="ErrorMessage">{errorMessage}</p>
|
|
234
|
-
{/if}
|
|
235
|
-
<button class="SignInButton" on:click={() => submitLoginForm()} disabled={isFormDataInvalid}>{$_('loginForm.loginButton')}</button>
|
|
236
|
-
<button class="ForgotPasswordButton" on:click={() => switchToForgotPassword()}>{$_('loginForm.loginForgotPassword')}</button>
|
|
237
|
-
</div>
|
|
244
|
+
{/if}
|
|
238
245
|
</div>
|
|
239
246
|
{#if !mobileView}
|
|
240
247
|
<div class="FormRightSide" style="background-image: url('{imagedesktop}')"></div>
|
|
@@ -274,7 +281,7 @@
|
|
|
274
281
|
}
|
|
275
282
|
.FormHeaderTitle {
|
|
276
283
|
color: #000000;
|
|
277
|
-
font-size:
|
|
284
|
+
font-size: 20px;
|
|
278
285
|
font-weight: 300;
|
|
279
286
|
padding: 0;
|
|
280
287
|
text-transform: uppercase;
|
package/src/translations.js
CHANGED
|
@@ -8,7 +8,7 @@ export const LoginForm = {
|
|
|
8
8
|
loginUsernameError: 'Name must be at least 2 characters long and contain no special characters. Email should contain \'@\' and a 2-3 letter long domain.',
|
|
9
9
|
loginPassword: 'Password',
|
|
10
10
|
loginPasswordError: 'Password must be 8-20 characters long and contain at least 1 uppercase letter, 1 number and 1 special character.',
|
|
11
|
-
loginButton: '
|
|
11
|
+
loginButton: 'Login',
|
|
12
12
|
loginForgotPassword: 'I forgot my password'
|
|
13
13
|
}
|
|
14
14
|
},
|
|
@@ -21,7 +21,7 @@ export const LoginForm = {
|
|
|
21
21
|
loginUsernameError: 'Ad en az 2 karakter uzunluğunda olmalı ve özel karakter içermemelidir. E-posta \'@\' ve 2-3 harf uzunluğunda bir etki alanı içermelidir.',
|
|
22
22
|
loginPassword: 'Parola',
|
|
23
23
|
loginPasswordError: 'Şifre 8-20 karakter uzunluğunda olmalı ve en az 1 büyük harf, 1 rakam ve 1 özel karakter içermelidir.',
|
|
24
|
-
loginButton: '
|
|
24
|
+
loginButton: 'Giriş yapmak',
|
|
25
25
|
loginForgotPassword: 'I forgot my password'
|
|
26
26
|
}
|
|
27
27
|
},
|