",closeButton:!0,signup:'False'==='True',ssoStatus:""}},loginCount:0,construct:function(o,n){$.e4eLogin.loginCount++,"body"===o.selector&&$("#admin_dialog").length<1&&($(o).prepend($('')),o=$("#admin_dialog"));var e="";"Azure AD"===e&&(e+=" (Office 365)"),$(o).append(!0===n.overlay?$("").addClass("admin_dialog_overlay").on("touchstart mousedown",(function(){$.e4eLogin.doClose($(this))})):"").append($("").addClass("admin_dialog_box").addClass("admin_dialog_box-login").addClass(n.formSettings.ssoStatus).append(!0===n.overlay&&!0===n.formSettings.closeButton?$("").addClass("login-close").addClass("admin_close").on("click",(function(){$.e4eLogin.doClose($(this))})):"").append(!1===n.minimal&&!0===n.formSettings.logo?$("").addClass("login-logo").append('').dblclick((function(o){o.preventDefault(),"sso_only"===n.formSettings.ssoStatus&&$(this).siblings(".login-sso-selector").hide().siblings("form").show()})):"").append(n.formSettings.loginHTML).append("sso_only"===n.formSettings.ssoStatus||"sso_enabled"===n.formSettings.ssoStatus?$("").addClass("login-sso-selector").append('Log in using '+e+"").append("sso_only"===n.formSettings.ssoStatus?"":$('Log in to the website directly').click((function(o){o.preventDefault(),$(this).parent().hide().siblings("form, .login-forgotten-form-container").show(),$(".login-input-form-fields").show()}))):"").append($("").addClass("login-input-form").append(n.formSettings.inputSettings.preHTML).append('').append(!1===n.minimal?$("").addClass("login-input-form-div").append($("").addClass("login-inputArea").append($("").addClass("admin_field").addClass("admin_field-icon").append($("").append('').attr("for","login-input-username_"+$.e4eLogin.loginCount)).append($("").addClass("login-input-username-input").attr({id:"login-input-username_"+$.e4eLogin.loginCount,type:"text",autocorrect:"off",autocapitalize:"none",name:"login-input-username-field",placeholder:"Email Address"}))).append($("").addClass("admin_field").addClass("admin_field-icon").append($("").append('').attr("for","login-input-password_"+$.e4eLogin.loginCount)).append($("").addClass("login-input-password-input").attr({id:"login-input-password_"+$.e4eLogin.loginCount,type:"password",name:"login-input-password-field",placeholder:"Password"}))).append($("").addClass("admin_field").addClass("admin_field-btn").append($("").addClass("login-input-login-button").attr({type:"submit",value:"Login"}))).append(!0===n.formSettings.signup?$("").addClass("login-signup-link").attr({href:"/users/signup.asp?pid=0"+(n.formSettings.redirectOnSignup?"&redir="+n.formSettings.redirectOnSignup:""),title:"Signup as a new user"}).append("Sign Up"):$("").addClass("login-signup-link").attr({href:"#"}).append(" ")).append($("").addClass("login-help-link").text(n.formSettings.forgottenButtonHTML).on("click",(function(){$(".login-input-form").hide(),$(".login-forgotten-form").show(),$(".admin_message-error").hide()})))):$("").addClass("login-input-form-fields").append(n.formSettings.loginHTML).append($("").addClass("login-input-username").append($("").append("Email Address:").attr("for","login-input-username_"+$.e4eLogin.loginCount)).append($("").addClass("login-input-username-input").attr({id:"login-input-username_"+$.e4eLogin.loginCount,type:"text",name:"login-input-username-field",placeholder:"Email Address"}))).append($("").addClass("login-input-password").append($("").append("Password:").attr("for","login-input-password_"+$.e4eLogin.loginCount)).append($("").addClass("login-input-password-input").attr({id:"login-input-password_"+$.e4eLogin.loginCount,type:"password",name:"login-input-password-field"}))).append($("").addClass("login-input-login").append($("").addClass("login-input-login-button").attr({type:"submit",value:"Login"})).append(!0===n.formSettings.signup?$("").addClass("login-signup-link btn").attr({href:"/users/signup.asp?pid=0"+(n.formSettings.redirectOnSignup?"&redir="+n.formSettings.redirectOnSignup:""),title:"Signup as a new user"}).append("Sign Up"):$(""))))).append(!0===n.formSettings.forgottenLink?$("").append($("").addClass("login-hr")).append($("").addClass("login-forgotten-link").append($("").append("Click here to reset your password").attr({href:"/admin/users/resetPassword.asp",title:"reset your password"}).click((function(o){o.preventDefault()})))):!0===n.formSettings.forgottenInput?(!0===n.minimal?$("").addClass("login-forgotten-form-container minimal").append($('Forgotten your password?').click((function(o){o.preventDefault(),$(this).siblings("form").toggle(),$(this).hide().parent().prev("form").hide()}))):$("")).append($("").css(!0===n.minimal?{display:"none"}:{}).submit((function(o){if(o.preventDefault(),o.stopPropagation(),""==$(".login-forgotten-input").val())return $.e4eLogin.doError($(".login-forgotten-input",this),"You must enter your email address.",!1),!1;$.e4eLogin.doForgotten($(this))})).addClass("login-forgotten-form").append(n.formSettings.forgottenInputSettings.preHTML).append($("").addClass("admin_field").append($("").addClass("login-forgotten-input login-input-username-input").attr({type:"text",name:"login-forgotten-input",placeholder:"Email Address",autocorrect:"off",autocapitalize:"none"}))).append($("").addClass("admin_field").addClass("admin_field-btn").append($("").addClass("login-forgotten-button").attr({type:"submit",value:"Reset Password"}))).append($('').addClass("login-help-link login-help-return").text("Return to Login").on("click",(function(o){o.preventDefault(),$(".login-post-message").empty(),$(".login-forgotten-form").hide().siblings().show(),$(".login-input-form").show()})))):"")).find("form.login-input-form").submit((function(o){o.preventDefault(),""!=$(".login-input-username-input",this).val().toLowerCase()?"juniper"!==$(".login-input-username-input",this).val().toLowerCase()?""!=$(".login-input-password-input",this).val()?$.e4eLogin.doLogin($(this),n.formSettings.redirectURL):$(".login-input-password-input",this).stop(!0,!0).animate({backgroundColor:"#FF5F5F"},200,(function(){$(this).animate({backgroundColor:"#ffffff"},200,(function(){$(this).animate({backgroundColor:"#FF5F5F"},200,(function(){$(this).animate({backgroundColor:"#ffffff"},200)}))}))})):window.location="/ssosp?internal=true":$(".login-input-username-input",this).stop(!0,!0).animate({backgroundColor:"#FF5F5F"},200,(function(){$(this).animate({backgroundColor:"#ffffff"},200,(function(){$(this).animate({backgroundColor:"#FF5F5F"},200,(function(){$(this).animate({backgroundColor:"#ffffff"},200)}))}))}))})),$(".admin_dialog_overlay").addClass("admin_dialog_overlay-fadein"),$(".admin_dialog_box").addClass("admin_dialog_box-slidein")},doClose:function(o){return $(".admin_dialog_box").removeClass("admin_dialog_box-slidein"),$(".admin_dialog_overlay").removeClass("admin_dialog_overlay-fadein"),setTimeout((function(){$("#admin_dialog").remove()}),1e3),this},doLogin:function(o,n){$(".login-post-message",o).remove(),o.closest(".admin_dialog_box").removeClass("admin_dialog_box-error"),"juniper"==$(".login-input-username-input",o).val()?$.ajax({url:"https://office.e4education.co.uk/autoLogin/home",dataType:"jsonp",type:"GET",success:function(n){!0===n.status?$.ajax({url:"/admin/login/login_ajax.asp",dataType:"json",data:{token:n.token},type:"POST",success:function(n){"success"==n.status||"Success"==n.status?($.e4eLogin.doError(o,"You have successfully logged in.",!0),$("body").css({cursor:"wait"}),currLocation=""+window.location,currLocation=currLocation.split("#")[0],currLocation=currLocation.split("&login=true")[0],window.location=currLocation):"disabled"==n.status?$.e4eLogin.doError(o,n.message,!1):($.e4eLogin.doError(o,"Sorry but either the email address or password you supplied doesn't match our records. If you have recently updated your user account please try your email address.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error"))},error:function(){$.e4eLogin.doError(o,"Sorry there was an error trying to log you in. Please try again.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error")}}):($.e4eLogin.doError(o,"Sorry there was an error trying to log you in. Please try again.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error"))},error:function(){$.e4eLogin.doError(o,"Sorry there was an error trying to log you in. Please try again.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error")}}):$.ajax({url:"/users/login_ajax.asp",dataType:"json",data:{username:$(".login-input-username-input",o).val(),password:$(".login-input-password-input",o).val(),totp:$(".login-input-totp-input",o).val()},type:"POST",success:function(n){if("success"==n.status||"Success"==n.status){var e;$.e4eLogin.doError(o,"You have successfully logged in.",!0),$("body").css({cursor:"wait"});var i=window.location.search.match(/ssolink=([^&]+)/);i&&2===i.length?e="/admin/login/remote/link.asp?sso=1&link="+i[1]:n.redirect?e=n.redirect:-1===(e=(e=(e=null!=$("#loginRedirectURL",o).val()?$("#loginRedirectURL",o).val():""+window.location).split("#")[0]).split("&login=true")[0]).indexOf("postLogin=true")&&(e+=(e.indexOf("?")>-1?"&":"?")+"postLogin=true"),setTimeout((function(){window.location=e}),0)}else"totp_req"==n.status?$(".admin_field-totp").length<1&&$.e4eLogin.doShowTotp():"totp_fail"==n.status?($.e4eLogin.doError(o,"The 2FA code provided could not be validated, please try again or contact support if you continue to experience this problem.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error")):"disabled"==n.status?$.e4eLogin.doError(o,n.message,!1):($.e4eLogin.doError(o,"Sorry but either the email address or password you supplied doesn't match our records. If you have recently updated your user account please try your email address.",!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error"))},error:function(n,e,i){$.e4eLogin.doError(o,"Sorry there was an error trying to log you in. Please try again. "+e+" - "+n.responseText,!1),o.closest(".admin_dialog_box").addClass("admin_dialog_box-error")}})},doError:function(o,n,e){$(".login-post-message").remove(),$(o).before($("").addClass("login-post-message").show().append($("").addClass("admin_message").addClass("admin_message-"+(e?"success":"error")).append(n)))},doShowTotp:function(){$(".login-input-login-button").parent().before($("").addClass("admin_field").addClass("admin_field-icon").addClass("admin_field-totp").append($("").append('').attr("for","login-input-totp"+$.e4eLogin.loginCount)).append($("").addClass("login-input-totp-input").attr({id:"login-input-totp"+$.e4eLogin.loginCount,type:"text",name:"login-input-totp-field",placeholder:"2FA Code"})).append($("").addClass("admin_email_totp_button").append($("").attr({id:"cmdSendTotpEmail",href:"#"}).text("Send 2FA code by email").click((function(o){o.preventDefault(),$.ajax({url:"/users/login_ajax.asp?totpemail=true",dataType:"json",type:"POST",data:{username:$(".login-input-username-input","form.login-input-form").val()},success:function(o){"totp_email_sent"==o.status?$.e4eLogin.doError($("form.login-input-form"),"We´ve sent your code to the email associated with the user account. Please ensure that noreply@juniperwebsites.co.uk is added to your safe senders list.",!0):$.e4eLogin.doError($("form.login-input-form"),o.message?o.message:"Sorry but we couldn´t find the user specified.",!1)},error:function(){$.e4eLogin.doError("form.login-input-form","Sorry but we couldn´t send your code, please try again.",!1)}})})))))},doForgotten:function(o){$.ajax({url:"/admin/login/password_reset.asp",dataType:"json",data:{username:$(".login-forgotten-input",o).val()},type:"POST",success:function(n){"success"==n.status?($(o)[0].children[1].style.display="none",$.e4eLogin.doError($(".login-forgotten-input",o),'
We've sent a password reminder to the email associated with the user account. Please ensure that noreply@juniperwebsites.co.uk is added to your safe senders list.
',!0),$(".login-forgotten-input",o).hide(),$(".login-forgotten-button",o).hide(),$(".login-help-return").hide(),$(".login-input-login-return",o).on("click",(function(){$(".login-post-message").empty(),$(".login-forgotten-form").hide(),$(o)[0].children[1].style.display="block",$(".login-input-form").show(),$(".login-forgotten-input",o).show(),$(".login-forgotten-button",o).show(),$(".login-help-return").show()}))):$.e4eLogin.doError($(".login-forgotten-input",o),n.message?n.message:"Sorry but we couldn´t find the user specified.",!1)},error:function(){$.e4eLogin.doError(o,"Sorry but we couldn´t find the user specified.",!1)}})},rePosition:function(o){}};