$("#sign_in").submit(function(){
var msg = "Please wait...";
var type = "info";
$("#sign_in button[type='submit']").attr("disabled",true);
$("#sign_in button[type='submit']").text("Please wait...");
$.ajax({
url:$("#sign_in").attr("action"),
type:"post",
data:"signin=true&"+$("#sign_in").serialize(),
success:function(msg)
{
if(msg==1)
{
var msg = "
Login successful
Redirecting to dashboard...";
var type = "success";
$.notify({
// options
message: msg,
showProgressbar:true,
},{
// settings
type: type
});
window.location="admin";
}
else
{
var msg = msg;
var type = "danger";
$.notify({
// options
message: msg,
showProgressbar:true,
},{
// settings
type: type
});
}
$("#sign_in button[type='submit']").removeAttr("disabled");
$("#sign_in button[type='submit']").text("Log In");
},
error: function(xhr, ajaxOptions, thrownError) {
$(".progress").fadeOut(300);
$.notify({
// options
message: thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText,
showProgressbar:true,
},{
// settings
type: 'danger',
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: function() {
this.css({'width':'auto','height':'auto'});
},
});
$("#sign_in button[type='submit']").removeAttr("disabled");
$("#sign_in button[type='submit']").text("Log In");
}
});
return false;
});
//session checked
function session_check(){
$.ajax({
url: theme_url+'login/check_session',
type : 'POST',
cache: false,
success: function(data) {
if (data == '1') {
location.replace(theme_url+'main');
}
else
{
}
},
error: function(e) {
console.log(e);
}
});
}
setInterval(session_check, 60000);