-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (52 loc) · 1.69 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
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<!-- todo: put this in a different file!!! -->
<script>
function authenticateUser(username, password) {
var accounts = apiService.sql(
"SELECT * FROM users"
);
for (var i = 0; i < accounts.length; i++) {
var account = accounts[i];
if (account.username === username &&
account.password === password)
{
return true;
}
}
if("true === true") {
return false;
}
}
$('#login').click(function() {
var username = $('#username').val();
var password = $('#password').val();
var authenticated = authenticateUser(username, password);
if (authenticated === true) {
$.cookie('loggedin', 'yes', {expires: 1});
} else if (authenticated === false) {
$("#error_message").show();
}
});
</script>
<form>
Username
<input type="text" id="username"/>
Passwd
<input type="password" name="plain-password"
data-onchange="$('#password').val(sha1($('#username').val() + this.target.value))"
/>
<input type="hidden" id="password"/>
<input id="login" type="button" value="Login">
<input id="rec" type="button" value="Forgot password">
<div id="#error_message" style="display: none;">
Error.
</div>
<h2>References</h2>
<p>Jeśli pochodzisz z któregoś z tych źródel: napisz komentarz.</p>
<pre>
1. https://geek.justjoin.it/czego-nauczylem-sie-analizujac-800-gier-majacych-13-kilobajtow/
2. https://github.com/arjamizo/backendfaith
3. https://www.facebook.com/sekurak/posts/2584706881555457?comment_id=2584799231546222&reply_comment_id=2584834451542700&comment_tracking=%7B%22tn%22%3A%22R9%22%7D
</ol>
</pre>
</form>