',true);
$('body').css({cursor:'wait'});
currLocation = ''+ window.location;
currLocation = currLocation.split('#')[0];
currLocation = currLocation.split('&login=true')[0];
window.location = currLocation;
}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'});
var currLocation;
var ssolink = window.location.search.match(/ssolink=([^&]+)/);
if (ssolink && ssolink.length===2) {
currLocation = '/admin/login/remote/link.asp?sso=1&link=' + ssolink[1];
} else if (data.redirect) {
currLocation = data.redirect;
} else {
if ($('#loginRedirectURL', formElem).val() != undefined) {
currLocation =$('#loginRedirectURL', formElem).val()
} else {
currLocation = '' + window.location;
}
currLocation = currLocation.split('#')[0];
currLocation = currLocation.split('&login=true')[0];
}
setTimeout(function() { window.location = currLocation; }, 0);
}else{
$.e4eLogin.doError(formElem,'Sorry but either the username or password you supplied doesn\'t match our records.',false);
}
},
error:function(jqXHR,textStatus,errorThrown){
$.e4eLogin.doError(formElem,'Sorry there was an error trying to log you in. Please try again. '+textStatus+' - '+jqXHR.responseText ,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.') + '