-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (87 loc) · 2.87 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sign in</title>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<style>
body {
margin: 0;
padding: 0;
font-size: 1.5em;
text-align: center;
color: var(--tg-theme-text-color);
background: var(--tg-theme-bg-color);
}
.container {
height: fit-content;
margin: auto;
}
.login-container {
margin: auto;
width: 12em;
text-align: left;
padding-top: 2em;
}
.password-container {
margin: auto;
width: 12em;
text-align: left;
padding-top: 2em;
}
input {
font-size: 1em;
width: 12em;
height: 2em;
border-radius: 20px;
margin-top: 0.5em;
padding-left: 0.5em;
}
input::placeholder {
font-size: 1em;
}
.error-container {
padding-top: 1em;
color: red;
}
</style>
</head>
<body>
<div class="container">
<div class="login-container">
<label>
Login
</label>
<br>
<input type="text" name="username" id="username" required placeholder="[email protected]">
</div>
<div class="password-container">
<label>
Password
</label>
<br>
<input type="password" name="password" id="password" required placeholder="password">
</div>
<div class="error-container">
<label id="wrong-data-hint">
</label>
</div>
</div>
<script>
let tg = window.Telegram.WebApp;
tg.expand();
tg.MainButton.setText("Login");
tg.MainButton.show();
Telegram.WebApp.onEvent('mainButtonClicked', function(){
let login = document.getElementById("username").value;
let password = document.getElementById("password").value;
if (login === "" || password === ""){
el = document.getElementById("wrong-data-hint");
el.textContent = "All fields are required!";
return;
}
tg.sendData(login + "\n" + password);
});
</script>
</body>
</html>