2013-09-20 16:58:11 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
|
|
|
|
|
|
<?php // INCLUDE JS FILES ?>
|
|
|
|
<script
|
|
|
|
type="text/javascript"
|
|
|
|
src="<?php echo $this->config->base_url(); ?>assets/js/libs/jquery/jquery.min.js"></script>
|
|
|
|
<script
|
|
|
|
type="text/javascript"
|
|
|
|
src="<?php echo $this->config->base_url(); ?>assets/js/libs/bootstrap/bootstrap.min.js"></script>
|
|
|
|
<script
|
|
|
|
type="text/javascript"
|
|
|
|
src="<?php echo $this->config->base_url(); ?>assets/js/libs/date.js"></script>
|
|
|
|
<script
|
|
|
|
type="text/javascript"
|
|
|
|
src="<?php echo $this->config->base_url(); ?>assets/js/general_functions.js"></script>
|
|
|
|
|
|
|
|
<?php // INCLUDE CSS FILES ?>
|
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
type="text/css"
|
|
|
|
href="<?php echo $this->config->base_url(); ?>assets/css/libs/bootstrap/bootstrap.css">
|
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
type="text/css"
|
|
|
|
href="<?php echo $this->config->base_url(); ?>assets/css/libs/bootstrap/bootstrap-responsive.css">
|
|
|
|
|
|
|
|
<?php // SET FAVICON FOR PAGE ?>
|
|
|
|
<link
|
|
|
|
rel="icon"
|
|
|
|
type="image/x-icon"
|
|
|
|
href="<?php echo $this->config->base_url(); ?>assets/images/favicon.ico">
|
|
|
|
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
background-color: #CAEDF3;
|
|
|
|
}
|
|
|
|
|
|
|
|
#login-frame {
|
|
|
|
width: 630px;
|
|
|
|
margin: 150px auto 0 auto;
|
|
|
|
background: #FFF;
|
|
|
|
border: 1px solid #DDDADA;
|
|
|
|
padding: 70px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#login-icon {
|
|
|
|
float: right;
|
|
|
|
margin-top: 17px;
|
|
|
|
}
|
|
|
|
|
|
|
|
label {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.forgot-password {
|
|
|
|
margin-left: 20px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2013-09-23 18:42:36 +03:00
|
|
|
<script type="text/javascript">
|
2013-09-20 16:58:11 +03:00
|
|
|
$(document).ready(function() {
|
|
|
|
var GlobalVariables = {
|
|
|
|
'baseUrl': <?php echo '"' . $base_url . '"'; ?>,
|
2013-09-23 18:42:36 +03:00
|
|
|
'destUrl': <?php echo '"' . $dest_url . '"'; ?>,
|
|
|
|
'AJAX_SUCCESS': 'SUCCESS',
|
|
|
|
'AJAX_FAILURE': 'FAILURE'
|
2013-09-20 16:58:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event: Login Button "Click"
|
|
|
|
*
|
|
|
|
* Make an ajax call to the server and check whether the user's credentials are right.
|
|
|
|
* If yes then redirect him to his desired page, otherwise display a message.
|
|
|
|
*/
|
2013-09-23 18:42:36 +03:00
|
|
|
$('#login-form').submit(function() {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
var postUrl = GlobalVariables.baseUrl + 'user/ajax_check_login';
|
2013-09-20 16:58:11 +03:00
|
|
|
var postData = {
|
|
|
|
'username': $('#username').val(),
|
|
|
|
'password': $('#password').val()
|
|
|
|
};
|
|
|
|
|
2013-09-23 18:42:36 +03:00
|
|
|
$('.alert').addClass('hidden');
|
|
|
|
|
2013-09-20 16:58:11 +03:00
|
|
|
$.post(postUrl, postData, function(response) {
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
console.log('Check Login Response: ', response);
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
2013-09-23 18:42:36 +03:00
|
|
|
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
|
|
|
|
|
|
|
|
if (response == GlobalVariables.AJAX_SUCCESS) {
|
|
|
|
window.location.href = GlobalVariables.destUrl;
|
2013-09-20 16:58:11 +03:00
|
|
|
} else {
|
|
|
|
$('.alert').text('Login failed, please enter the correct credentials '
|
|
|
|
+ 'and try again.');
|
|
|
|
$('.alert').removeClass('hidden');
|
|
|
|
}
|
2013-09-23 18:42:36 +03:00
|
|
|
}, 'json');
|
2013-09-20 16:58:11 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="login-frame" class="frame-container">
|
2013-09-23 18:42:36 +03:00
|
|
|
<h2>Backend Section</h2>
|
|
|
|
<p>Welcome! You will need to login in order to view backend pages.</p>
|
2013-09-20 16:58:11 +03:00
|
|
|
<hr>
|
|
|
|
<div class="alert hidden"></div>
|
2013-09-23 18:42:36 +03:00
|
|
|
<form id="login-form">
|
2013-09-20 16:58:11 +03:00
|
|
|
<label for="username">Username</label>
|
|
|
|
<input type="text" id="username" placeholder="Enter your username here ..." />
|
|
|
|
|
|
|
|
<label for="password">Password</label>
|
|
|
|
<input type="password" id="password" placeholder="Enter your password here ..." />
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
2013-09-23 18:42:36 +03:00
|
|
|
<button type="submit" id="login" class="btn btn-primary btn-large">Login</button>
|
2013-09-20 16:58:11 +03:00
|
|
|
|
|
|
|
<a href="<?php echo $base_url; ?>user/forgot_password" class="forgot-password">Forgot Your Password?</a>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|