blob: 1f9ef4584c5fe1515741a3494fbe48c944e0af4d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<script>
import Button from "../ComponentLib/Button/Button.svelte";
import { authenticate } from "../stores/socketStore";
let isLoading = false;
let username;
let password;
let errorMessage = null;
function tryLogin() {
isLoading = true;
authenticate(username, password, (success) => {
if (!success) {
errorMessage = "Username/password incorrect";
setTimeout(() => {
errorMessage = null;
}, 5000);
}
isLoading = false;
});
}
</script>
<style>
main {
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: #3c3b3b;
text-align: center;
}
.login {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
background-color: white;
border-radius: 15px;
max-width: 200px;
box-sizing: border-box;
}
img {
margin-bottom: -18px;
margin-top: -5px;
}
form {
padding: 15px;
padding-top: 0;
text-align: left;
}
h2 {
margin: 0;
}
input {
width: 100%;
margin-top: 5px;
margin-bottom: 5px;
box-sizing: border-box;
border: none;
padding: 10px 15px;
background: var(--grey-200);
border-radius: 5px;
}
label {
font-size: 12px;
color: var(--grey-600);
margin-bottom: 5px;
}
.error-message {
color: var(--red-500);
font-size: 12px;
margin: 15px;
margin-top: 0;
}
</style>
<main>
<div class="login">
<img src="./assets/img/logo/Icon-192h.png" alt="">
<!-- <h2>Luxcena neo Login</h2> -->
<form on:submit|preventDefault={tryLogin}>
<label for="username">Username</label>
<input type="text" id="username" autocomplete="username" minlength="1" required bind:value={username} />
<label for="password">Password</label>
<input type="password" id="password" autocomplete="current-password" minlength="1" required bind:value={password} />
<Button fullWidth=true>
{#if isLoading}
<i class="fas fa-spinner fa-pulse"></i>
{:else}
Login
{/if}
</Button>
</form>
{#if errorMessage}
<div class="error-message">
{errorMessage}
</div>
{/if}
</div>
</main>
|