',true);
$('body').css({cursor:'wait'});
if (data.redirect) {
currLocation = data.redirect;
//if (window.console){console.log('redirect:'+data.redirect);}
} else {
if ($('#loginRedirectURL', formElem).val() != undefined) {
currLocation =$('#loginRedirectURL', formElem).val()
//if (window.console){console.log('user defined:'+currLocation);}
} else {
currLocation = '' + window.location;
//if (window.console){console.log('window.location:');}
}
currLocation = currLocation.split('#')[0];
currLocation = currLocation.split('&login=true')[0];
}
window.location = currLocation;
//currLocation = ''+ window.location;
//currLocation = currLocation.split('#')[0];
//currLocation = currLocation.split('&login=true')[0];
//window.location = currLocation;
}else if (data.status == 'locked' || data.status == 'Locked'){
$.e4eLogin.doError(formElem,'We\'re sorry, your account is currently locked. If you feel this is incorrect please contact the website administrator.',false);
} else {
$.e4eLogin.doError(formElem,'Sorry but either the username or password you supplied doesn\'t match our records.',false);
}
},
error: function(){
$.e4eLogin.doError(formElem,'Sorry there was an error trying to log you in. Please try again.',false);
}
});
} else {
$.e4eLogin.doError(formElem,'Sorry there was an error trying to log you in. Please try again.',false);
}
},
error: function(){
$.e4eLogin.doError(formElem,'Sorry there was an error trying to log you in. Please try again.',false);
}
});
} else {
$.ajax({
url:'/users/login_ajax.asp',
dataType:'json',
data:{username:$('.login-input-username-input', formElem).val(),password:$('.login-input-password-input', formElem).val()},
type: 'POST',
success: function(data){
if(data.status == 'success' || data.status == 'Success'){
$.e4eLogin.doError(formElem,'
You have successfully logged in. Please wait...
',true);
$('body').css({cursor:'wait'});
if (data.redirect) {
currLocation = data.redirect;
//if (window.console){console.log('redirect:'+data.redirect);}
} else {
if ($('#loginRedirectURL', formElem).val() != undefined) {
currLocation =$('#loginRedirectURL', formElem).val()
//if (window.console){console.log('user defined:'+currLocation);}
} else {
currLocation = '' + window.location;
//if (window.console){console.log('window.location:');}
}
currLocation = currLocation.split('#')[0];
currLocation = currLocation.split('&login=true')[0];
}
window.location = currLocation;
}else if (data.status == 'locked' || data.status == 'Locked'){
$.e4eLogin.doError(formElem,'We\'re sorry, your account is currently locked. If you feel this is incorrect please contact the website administrator.',false);
} else {
$.e4eLogin.doError(formElem,'Sorry but either the username or password you supplied doesn\'t match our records.',false);
}
},
error:function(){
$.e4eLogin.doError(formElem,'Sorry there was an error trying to log you in. Please try again.',false);
}
});
}
},
doError:function(formElem,strError,blnSuccess){
$('.login-post-message',formElem).remove();
$(formElem).append(
$('')
.addClass('login-post-message')
.css({
color:blnSuccess ? '#198F08' : '#FF5F5F',
borderColor:blnSuccess ? '#198F08' : '#FF5F5F',
background:blnSuccess ? '#DDFFCC' : '#FFEFEF'
})
.append(
$('').append(strError)
)
.append(
$('')
.addClass('login-error-close')
.append('Click here to close this message')
.click(function(){
$(this).parent().remove();
})
)
);
},
doForgotten:function(formElem){
$.ajax({
url:'/admin/login/password_reset.asp',
dataType:'json',
data:{username:$('.login-forgotten-input', formElem).val()},
type: 'POST',
success: function(data){
if(data.status == 'success'){
$.e4eLogin.doError(formElem,'
Reminder Sent
We´ve sent a password reminder to the email associated with the user account. Please ensure that website@e4education.co.uk is added to your safe senders list.
',true);
}else{
$.e4eLogin.doError(formElem,'
User Not Found
' + (data.message ? data.message : 'Sorry but we couldn´t find the user specified.') + '