This repository has been archived by the owner on Oct 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
login.php
117 lines (103 loc) · 5.13 KB
/
login.php
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
107
108
109
110
111
112
113
114
115
116
117
<?php
require_once('includes/inc.php');
$error = false;
if (!empty($_SESSION['login_string'])) {
header('Location: index.php');
exit();
} else if (!empty($_POST['username']) && !empty($_POST['password'])) {
require_once('includes/classes/login.php');
$loginObj = new Login();
if ($loginObj->login(trim($_POST['username']), trim($_POST['password'])) !== FALSE) {
$_SESSION['login_string'] = hash('sha512', $_POST['password'] . $_SERVER['HTTP_USER_AGENT']);
session_regenerate_id(); // This hangs sometimes and we dont know why...
session_write_close();
header('Location: index.php');
exit();
} else {
unset($_SESSION['login_string']);
$error = true;
}
}
session_write_close();
include("includes/login-header.php");
?>
<div id="dashboard-wrap" class="container sub-nav login-container">
<div id="overview" class="panel panel-primary panel-no-grid panel-overview">
<h1>Login</h1>
<div class="panel-heading">
<h2 class="panel-title"><small><i class="icon icon-enteralt"></i></small></h2>
</div>
<div class="panel-body panel-body-overview">
<div id="panel-login">
<form method="POST" class="form-horizontal" role="form">
<div class="form-group">
<label for="username" class="col-sm-offset-1 col-sm-3 control-label"><i class="icon icon-user"></i></label>
<div class="col-sm-4">
<input type="text" name="username" id="username" placeholder="Username" class="form-control">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-offset-1 col-sm-3 control-label"><i class="icon icon-key"></i></label>
<div class="col-sm-4">
<input type="password" name="password" id="password" class="form-control" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-lg btn-warning"><b>Login now!</b></button>
</div>
</div>
</form>
</div>
</div><!-- / .panel-body -->
<div class="panel-footer">
<p><b>Forgot your password?</b> Well then, you'll need to delete the file <em>/<?php echo DATA_FOLDER; ?>/configs/account.json</em>, then log in with a fresh account immediately.</p>
<hr>
<p><span>Still having trouble? Touch base with us on <a href="https://plus.google.com/u/0/b/110896112995796953409/communities/111042089628113521779" rel="external"><i class="icon icon-googleplus"></i></a> <a href="http://reddit.com/r/cryptoglance" rel="external"><i class="icon icon-reddit"></i></a> <a href="http://twitter.com/cryptoglance" rel="external"><i class="icon icon-twitter"></i></a> or <a href="http://webchat.freenode.net/?channels=%23cryptoGlance&uio=OT10cnVlJjExPTIwNQa5" rel="external">join our IRC chat</a>.</span></p>
</div>
</div>
</div>
<!-- /container -->
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.toastmessage.js"></script>
<script type="text/javascript" src="js/bootstrap-switch.min.js"></script>
<!-- TODO: Put another PHP if statement which checks if it's the user's first time here (no account.json)
// (Toast) First login (no account.json)
function showToastFirstLogin() {
var toastMsgFirstLogin = '<b>Read Carefully!</b> This is your first time logging into cryptoGlance. Please set a new username + password that will serve as your credentials.';
$().toastmessage('showToast', {
sticky : true,
text : toastMsgFirstLogin,
type : 'warning',
position: 'top-center'
});
}
$(document).ready(function() {
showToastFirstLogin();
});
-->
<?php
if ($error) {
?>
<script type="text/javascript">
// (Toast) Login error
function showToastLoginError() {
var toastMsgLoginError = '<b>You shall NOT pass!</b> You\'ve entered incorrect credentials. (If you\'re having trouble, read the notes below the login button.)';
$().toastmessage('showToast', {
sticky : true,
text : toastMsgLoginError,
type : 'error',
position: 'top-center'
});
}
$(document).ready(function() {
showToastLoginError();
});
</script>
<?php
}
?>
</body>
</html>