-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
81 lines (64 loc) · 2.47 KB
/
script.js
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
function OpenMenuBar() {
var navBar = document.querySelector("nav")
if (navBar.className === "navbar") {
navBar.className += " responsive";
} else {
navBar.className = "navbar";
}
var menuIcon = document.querySelector(".menu-bars");
if (menuIcon.className === "menu-bars") {
menuIcon.className += " responsive";
} else {
menuIcon.className = "menu-bars";
}
var icons = document.querySelector(".icons");
if (icons.className === "icons") {
icons.className += " responsive";
} else {
icons.className = "icons";
}
}
function OpenLoginForm() {
var loginForm = document.getElementById("login-form");
loginForm.style.display = "flex"
}
async function Login() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
// 1. time
username = await sha256(username);
password = await sha256(password);
// 2. time
username = await sha256(username);
password = await sha256(password);
if (username === "68597891389543d8004058d4069db8be0548a3851c169f0bc76343982d65b224" && password === "a32b8d057401acc1aa5bc57a63ee1a6154105c79e9315dfbeef8e5435c59d388") {
LoginLogic()
}
else {
var pCorrect = document.getElementById("is-correct")
pCorrect.innerText = "Benutzername oder Passwort sind falsch!"
}
}
function LoginLogic() {
CloseLoginForm()
var addPatchnoteSection = document.getElementById("add-new-patchnote");
addPatchnoteSection.style.display = "block";
}
function CloseLoginForm() {
var loginForm = document.getElementById("login-form");
loginForm.style.display = "none";
}
function SendPatchnote() {
var patchnoteVersion = document.getElementById("patchnote-version").value;
var patchnoteDescription = document.getElementById("patchnote-description").value;
window.open(`mailto:msmprojektkursinfo@gmail.com?subject=${ encodeURI(patchnoteVersion) }&body=${ encodeURI(patchnoteDescription) }`);
}
async function sha256(inputString) {
const encoder = new TextEncoder();
const data = encoder.encode(inputString);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
// sha256("Put whatever here").then(hash => sha256(hash).then(hash2 => console.log(hash2)));