1 line
34 KiB
Handlebars
1 line
34 KiB
Handlebars
<!DOCTYPE html> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="format-detection" content="telephone=no"> <link rel="shortcut icon" type="image/x-icon" href="{{{domainurl}}}favicon.ico"> <title>MeshCentral - Login</title> <style> a{color:#036;text-decoration:underline;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}</style> </head> <body onload="if (typeof(startup) !== 'undefined') startup();" style="overflow-y:hidden;margin:0;padding:0;border:0;color:black;font-size:13px;font-family:\'Trebuchet MS\', Arial, Helvetica, sans-serif"> <div id="container"> <div id="mastheadx"></div> <div id="masthead" style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden"> <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px"> <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong> </div> <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px"> <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong> </div> </div> <div id="page_content" style="overflow-y:scroll;position:absolute;bottom:32px;top:50px;width:100%;display:flex;align-items:center"> <div id="column_l" style="padding:10px;width:100%"> <table style="width:100%"> <tr> <td align="center"> <div id="loginpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;display:none"> <form method="post"> <input type="hidden" name="action" value="login"> <div id="message1"> {{{message}}} </div> <div> <b>Log In</b> </div> <table> <tr> <td id="loginusername" align="right" width="100">Username:</td> <td><input id="username" type="text" maxlength="64" name="username" onchange="validateLogin(1)" onkeyup="validateLogin(1,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="password" type="password" maxlength="256" name="password" autocomplete="off" onchange="validateLogin(2)" onkeyup="validateLogin(2,event)"></td> </tr> <tr> <td><div id="showPassHintLink" style="display:none"><a onclick="showPassHint()" style="cursor:pointer">Show Hint</a></div></td> <td align="right"><input id="loginButton" type="submit" value="Log In" disabled="disabled"></td> </tr> </table> <div id="hrAccountDiv" style="display:none"><hr></div> <div id="resetAccountDiv" style="display:none;padding:2px"> <span id="resetAccountSpan">Forgot user/password?</span> <a onclick="xgo(3)" style="cursor:pointer">Reset account</a>. </div> <div id="newAccountDiv" style="display:none;padding:2px"> Don't have an account? <a onclick="xgo(2)" style="cursor:pointer">Create one</a>. </div> <input id="loginformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="createpanel" style="display:none"> <div style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;clear:both;position:relative"> <form method="post"> <input type="hidden" name="action" value="createaccount"> <div id="message2"> {{{message}}} </div> <div> <b>Account Creation</b> </div> <div id="passwordPolicyCallout" style="left:-5px;top:10px;width:100px;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div> <table> <tr id="nuUserRow"> <td align="right" width="100">Username:</td> <td><input id="ausername" type="text" name="username" onchange="validateCreate(1)" maxlength="64" onkeydown="haltReturn(event)" onkeyup="validateCreate(1,event)"></td> </tr> <tr> <td align="right" width="100">Email:</td> <td><input id="aemail" type="text" name="email" onchange="validateCreate(2)" maxlength="256" onkeydown="haltReturn(event)" onkeyup="validateCreate(2,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword1" type="password" name="password1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(3)" onkeyup="validateCreate(3,event)"></td> </tr> <tr> <td align="right">Password:</td> <td><input id="apassword2" type="password" name="password2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(4)" onkeyup="validateCreate(4,event)"></td> </tr> <tr id="createPanelHint" style="display:none"> <td align="right">Pass Hint:</td> <td><input id="apasswordhint" type="text" name="apasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(5)" onkeyup="validateCreate(5,event)"></td> </tr> <tr id="newAccountPass" title="Enter the account creation token"> <td align="right">Creation Token:</td> <td><input id="anewaccountpass" type="password" name="anewaccountpass" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validateCreate(6)" onkeyup="validateCreate(6,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="createButton" type="submit" value="Create Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="createformargs" name="urlargs" type="hidden" value=""> </form> </div> </div> <div id="resetpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post"> <input type="hidden" name="action" value="resetaccount"> <div id="message3"> {{{message}}} </div> <div> <b>Account Reset</b> </div> <table> <tr> <td align="right" width="100">Email:</td> <td><input id="remail" type="text" name="email" maxlength="256" onchange="validateReset()" onkeyup="validateReset(event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="eresetButton" type="submit" value="Reset Account" disabled="disabled"></div> <div id="passWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resetformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="tokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post" autocomplete="off"> <input type="hidden" name="action" value="tokenlogin"> <input type="hidden" name="hwstate" value="{{{hwstate}}}"> <div id="message4"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="tokenInput" type="text" name="token" maxlength="50" onchange="checkToken(event)" onkeyup="checkToken(event)" onkeydown="checkToken(event)" onfocus="checkTokenTimer(1)" onblur="checkTokenTimer(0)"> <input id="hwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="tokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="tokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resettokenpanel" style="background-color:#979797;border-radius:16px;width:260px;padding:16px;text-align:center;display:none;clear:both"> <form method="post" autocomplete="off"> <input type="hidden" name="action" value="resetaccount"> <div id="message5"> {{{message}}} </div> <table> <tr> <td align="right" width="100">Login token:</td> <td> <input id="resetTokenInput" type="text" name="token" maxlength="50" onchange="resetCheckToken(event)" onpaste="resetCheckToken(event)" onkeyup="resetCheckToken(event)" onkeydown="resetCheckToken(event)"> <input id="resetHwtokenInput" type="text" name="hwtoken" style="display:none"> </td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetTokenOkButton" type="submit" value="Login" disabled="disabled"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resettokenformargs" name="urlargs" type="hidden" value=""> </form> </div> <div id="resetpasswordpanel" style="position:relative;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;display:none"> <form method="post"> <input type="hidden" name="action" value="resetpassword"> <div id="message6"> {{{message}}} </div> <div id="rpasswordPolicyCallout" style="left:-10px;width:100px;display:none;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px"></div> <table> <tr> <td id="rnuPass1" width="100" align="right">Password:</td> <td><input id="rapassword1" type="password" name="rpassword1" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(3,event)" onkeyup="validatePassReset(3,event)"></td> </tr> <tr> <td id="rnuPass2" align="right">Password:</td> <td><input id="rapassword2" type="password" name="rpassword2" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(4,event)" onkeyup="validatePassReset(4,event)"></td> </tr> <tr id="resetpasswordpanelHint" style="display:none"> <td id="rnuHint" align="right">Password Hint:</td> <td><input id="rapasswordhint" type="text" name="rpasswordhint" autocomplete="off" maxlength="256" onkeydown="haltReturn(event)" onchange="validatePassReset(5,event)" onkeyup="validatePassReset(5,event)"></td> </tr> <tr> <td colspan="2"> <div style="float:right"><input id="resetPassButton" type="submit" value="Reset Password" disabled="disabled"></div> <div id="rpassWarning" style="padding-top:6px"></div> </td> </tr> </table> <hr><a onclick="xgo(1)" style="cursor:pointer">Back to login</a> <input id="resetpasswordformargs" name="urlargs" type="hidden" value=""> </form> </div> </td> </tr> </table> </div> </div> <div id="footer" style="height:32px;width:100%;text-align:center;background-color:#113962;position:absolute;bottom:0px"> <table cellpadding="0" cellspacing="6" style="width:100%"> <tr> <td style="text-align:left;color:white">{{{footer}}}</td> <td style="text-align:right">{{{rootCertLink}}} <a href="terms">Terms & Privacy</a></td> </tr> </table> </div> </div> <div id="dialog" style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;width:400px;display:none"> <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"> <div id="id_dialogclose" style="float:right;padding:5px;cursor:pointer" onclick="setDialogMode()"><b>X</b></div> <div id="id_dialogtitle" style="padding:5px"></div> <div style="width:100%;margin:6px"></div> </div> <div style="margin-right:16px;margin-left:8px"> <div id="dialog1" style="margin:auto;text-align:center;margin:3px"> <div id="id_dialogMessage" style="padding:10px"></div> </div> <div id="dialog2" style="margin:auto;margin:3px"> <div id="id_dialogOptions"></div> </div> </div> <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:20px"> <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)"> <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)"> </div> </div> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g," ")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}function zeroPad(b,a){if(a==null){a=2}var d="00000000"+b;return d.substr(d.length-a)}"use strict";if(!window.u2f){var u2f=u2f||{};var js_api_version;u2f.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd";u2f.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_SIGN_RESPONSE:"u2f_sign_response",U2F_GET_API_VERSION_REQUEST:"u2f_get_api_version_request",U2F_GET_API_VERSION_RESPONSE:"u2f_get_api_version_response"};u2f.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5};u2f.U2fRequest;u2f.U2fResponse;u2f.Error;u2f.Transport;u2f.Transports;u2f.SignRequest;u2f.SignResponse;u2f.RegisterRequest;u2f.RegisterResponse;u2f.RegisteredKey;u2f.GetJsApiVersionResponse;u2f.getMessagePort=function(a){if(typeof chrome!="undefined"&&chrome.runtime){var b={type:u2f.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(u2f.EXTENSION_ID,b,function(){if(!chrome.runtime.lastError){u2f.getChromeRuntimePort_(a)}else{u2f.getIframePort_(a)}})}else{if(u2f.isAndroidChrome_()){u2f.getAuthenticatorPort_(a)}else{if(u2f.isIosChrome_()){u2f.getIosPort_(a)}else{u2f.getIframePort_(a)}}}};u2f.isAndroidChrome_=function(){var a=navigator.userAgent;return a.indexOf("Chrome")!=-1&&a.indexOf("Android")!=-1};u2f.isIosChrome_=function(){var b=["iPhone","iPad","iPod"];for(var a in b){if(navigator.platform==b[a]){return true}}return false};u2f.getChromeRuntimePort_=function(a){var b=chrome.runtime.connect(u2f.EXTENSION_ID,{includeTlsChannelId:true});setTimeout(function(){a(new u2f.WrappedChromeRuntimePort_(b))},0)};u2f.getAuthenticatorPort_=function(a){setTimeout(function(){a(new u2f.WrappedAuthenticatorPort_())},0)};u2f.getIosPort_=function(a){setTimeout(function(){a(new u2f.WrappedIosPort_())},0)};u2f.WrappedChromeRuntimePort_=function(a){this.port_=a};u2f.formatSignRequest_=function(a,b,d,g,e){if(js_api_version===undefined||js_api_version<1.1){var f=[];for(var c=0;c<d.length;c++){f[c]={version:d[c].version,challenge:b,keyHandle:d[c].keyHandle,appId:a}}return{type:u2f.MessageTypes.U2F_SIGN_REQUEST,signRequests:f,timeoutSeconds:g,requestId:e}}return{type:u2f.MessageTypes.U2F_SIGN_REQUEST,appId:a,challenge:b,registeredKeys:d,timeoutSeconds:g,requestId:e}};u2f.formatRegisterRequest_=function(a,c,d,g,e){if(js_api_version===undefined||js_api_version<1.1){for(var b=0;b<d.length;b++){d[b].appId=a}var f=[];for(var b=0;b<c.length;b++){f[b]={version:c[b].version,challenge:d[0],keyHandle:c[b].keyHandle,appId:a}}return{type:u2f.MessageTypes.U2F_REGISTER_REQUEST,signRequests:f,registerRequests:d,timeoutSeconds:g,requestId:e}}return{type:u2f.MessageTypes.U2F_REGISTER_REQUEST,appId:a,registerRequests:d,registeredKeys:c,timeoutSeconds:g,requestId:e}};u2f.WrappedChromeRuntimePort_.prototype.postMessage=function(a){this.port_.postMessage(a)};u2f.WrappedChromeRuntimePort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c=="message"||c=="onmessage"){this.port_.onMessage.addListener(function(d){b({data:d})})}else{console.error("WrappedChromeRuntimePort only supports onMessage")}};u2f.WrappedAuthenticatorPort_=function(){this.requestId_=-1;this.requestObject_=null};u2f.WrappedAuthenticatorPort_.prototype.postMessage=function(b){var a=u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_+";S.request="+encodeURIComponent(JSON.stringify(b))+";end";document.location=a};u2f.WrappedAuthenticatorPort_.prototype.getPortType=function(){return"WrappedAuthenticatorPort_"};u2f.WrappedAuthenticatorPort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c=="message"){var d=this;window.addEventListener("message",d.onRequestUpdate_.bind(d,b),false)}else{console.error("WrappedAuthenticatorPort only supports message")}};u2f.WrappedAuthenticatorPort_.prototype.onRequestUpdate_=function(a,d){var e=JSON.parse(d.data);var c=e.intentURL;var b=e.errorCode;var f=null;if(e.hasOwnProperty("data")){f=(JSON.parse(e.data))}a({data:f})};u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_="intent:#Intent;action=com.google.android.apps.authenticator.AUTHENTICATE";u2f.WrappedIosPort_=function(){};u2f.WrappedIosPort_.prototype.postMessage=function(a){var b=JSON.stringify(a);var c="u2f://auth?"+encodeURI(b);location.replace(c)};u2f.WrappedIosPort_.prototype.getPortType=function(){return"WrappedIosPort_"};u2f.WrappedIosPort_.prototype.addEventListener=function(a,b){var c=a.toLowerCase();if(c!=="message"){console.error("WrappedIosPort only supports message")}};u2f.getIframePort_=function(a){var d="chrome-extension://"+u2f.EXTENSION_ID;var c=document.createElement("iframe");c.src=d+"/u2f-comms.html";c.setAttribute("style","display:none");document.body.appendChild(c);var b=new MessageChannel();var e=function(f){if(f.data=="ready"){b.port1.removeEventListener("message",e);a(b.port1)}else{console.error('First event on iframe port was not "ready"')}};b.port1.addEventListener("message",e);b.port1.start();c.addEventListener("load",function(){c.contentWindow.postMessage("init",d,[b.port2])})};u2f.EXTENSION_TIMEOUT_SEC=30;u2f.port_=null;u2f.waitingForPort_=[];u2f.reqCounter_=0;u2f.callbackMap_={};u2f.getPortSingleton_=function(a){if(u2f.port_){a(u2f.port_)}else{if(u2f.waitingForPort_.length==0){u2f.getMessagePort(function(b){u2f.port_=b;u2f.port_.addEventListener("message",(u2f.responseHandler_));while(u2f.waitingForPort_.length){u2f.waitingForPort_.shift()(u2f.port_)}})}u2f.waitingForPort_.push(a)}};u2f.responseHandler_=function(b){var d=b.data;var c=d.requestId;if(!c||!u2f.callbackMap_[c]){console.error("Unknown or missing requestId in response.");return}var a=u2f.callbackMap_[c];delete u2f.callbackMap_[c];a(d.responseData)};u2f.sign=function(a,c,e,b,d){if(js_api_version===undefined){u2f.getApiVersion(function(f){js_api_version=f.js_api_version===undefined?0:f.js_api_version;u2f.sendSignRequest(a,c,e,b,d)})}else{u2f.sendSignRequest(a,c,e,b,d)}};u2f.sendSignRequest=function(a,c,e,b,d){u2f.getPortSingleton_(function(f){var h=++u2f.reqCounter_;u2f.callbackMap_[h]=b;var i=(typeof d!=="undefined"?d:u2f.EXTENSION_TIMEOUT_SEC);var g=u2f.formatSignRequest_(a,c,e,i,h);f.postMessage(g)})};u2f.register=function(a,e,d,b,c){if(js_api_version===undefined){u2f.getApiVersion(function(f){js_api_version=f.js_api_version===undefined?0:f.js_api_version;u2f.sendRegisterRequest(a,e,d,b,c)})}else{u2f.sendRegisterRequest(a,e,d,b,c)}};u2f.sendRegisterRequest=function(a,e,d,b,c){u2f.getPortSingleton_(function(f){var h=++u2f.reqCounter_;u2f.callbackMap_[h]=b;var i=(typeof c!=="undefined"?c:u2f.EXTENSION_TIMEOUT_SEC);var g=u2f.formatRegisterRequest_(a,d,e,i,h);f.postMessage(g)})};u2f.getApiVersion=function(a,b){u2f.getPortSingleton_(function(d){if(d.getPortType){var c;switch(d.getPortType()){case"WrappedIosPort_":case"WrappedAuthenticatorPort_":c=1.1;break;default:c=0;break}a({js_api_version:c});return}var f=++u2f.reqCounter_;u2f.callbackMap_[f]=a;var e={type:u2f.MessageTypes.U2F_GET_API_VERSION_REQUEST,timeoutSeconds:(typeof b!=="undefined"?b:u2f.EXTENSION_TIMEOUT_SEC),requestId:f};d.postMessage(e)})}}"use strict";var passhint="{{{passhint}}}";var newAccountPass=parseInt("{{{newAccountPass}}}");var emailCheck=("{{{emailcheck}}}"=="true");var features=parseInt("{{{features}}}");var passRequirements="{{{passRequirements}}}";if(passRequirements!=""){passRequirements=JSON.parse(decodeURIComponent(passRequirements))}else{passRequirements={}}var passRequirementsEx=((passRequirements.min!=null)||(passRequirements.max!=null)||(passRequirements.upper!=null)||(passRequirements.lower!=null)||(passRequirements.numeric!=null)||(passRequirements.nonalpha!=null));var hardwareKeyChallenge=decodeURIComponent("{{{hkey}}}");var currentpanel=0;if(window.location.href.indexOf("?")>0){var urlargs=window.location.href.substring(window.location.href.indexOf("?"));Q("loginformargs").value=urlargs;Q("createformargs").value=urlargs;Q("resetformargs").value=urlargs;Q("tokenformargs").value=urlargs;Q("resettokenformargs").value=urlargs;Q("resetpasswordformargs").value=urlargs}function startup(){if((features&32)==0){var d=null;try{d=top.location.toString().toLowerCase()}catch(a){}if(top!=self&&(d==null||top.active==false)){top.location=self.location;return}}if(features&2097152){QH("loginusername","Email:");QH("resetAccountSpan","Forgot password?");QV("nuUserRow",false)}QV("createPanelHint",passRequirements.hint===true);QV("resetpasswordpanelHint",passRequirements.hint===true);window.onresize=center;center();validateLogin();validateCreate();if("{{loginmode}}"!=""){go(parseInt("{{loginmode}}"))}else{go(1)}QV("newAccountDiv",("{{{newAccount}}}"==="1")||("{{{newAccount}}}"==="true"));if((passRequirements.hint===true)&&(passhint!=null)&&(passhint.length>0)){QV("showPassHintLink",true)}QV("newAccountPass",(newAccountPass==1));QV("resetAccountDiv",(emailCheck==true));QV("hrAccountDiv",(emailCheck==true)||(newAccountPass==1));if("{{loginmode}}"=="4"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;var f={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){f.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:f}).then(function(g){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(g.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.authenticatorData))),};Q("hwtokenInput").value=JSON.stringify(e);QE("tokenOkButton",true);Q("tokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}if("{{loginmode}}"=="5"){try{if(hardwareKeyChallenge.length>0){hardwareKeyChallenge=JSON.parse(hardwareKeyChallenge)}else{hardwareKeyChallenge=null}}catch(b){hardwareKeyChallenge=null}if((hardwareKeyChallenge!=null)&&(hardwareKeyChallenge.type=="webAuthn")){hardwareKeyChallenge.challenge=Uint8Array.from(atob(hardwareKeyChallenge.challenge),function(e){return e.charCodeAt(0)}).buffer;var f={challenge:hardwareKeyChallenge.challenge,allowCredentials:[],timeout:hardwareKeyChallenge.timeout};for(var c=0;c<hardwareKeyChallenge.keyIds.length;c++){f.allowCredentials.push({id:Uint8Array.from(atob(hardwareKeyChallenge.keyIds[c]),function(e){return e.charCodeAt(0)}),type:"public-key",transports:["usb","ble","nfc"],})}navigator.credentials.get({publicKey:f}).then(function(g){var e={id:btoa(String.fromCharCode.apply(null,new Uint8Array(g.rawId))),clientDataJSON:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.clientDataJSON))),userHandle:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.userHandle))),signature:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.signature))),authenticatorData:btoa(String.fromCharCode.apply(null,new Uint8Array(g.response.authenticatorData))),};Q("resetHwtokenInput").value=JSON.stringify(e);QE("resetTokenOkButton",true);Q("resetTokenOkButton").click()},function(e){console.log("credentials-get error",e)})}}}function showPassHint(){if(passRequirements.hint===true){messagebox("Password Hint",passhint)}}function xgo(a){QV("message1",false);QV("message2",false);QV("message3",false);QV("message4",false);QV("message5",false);QV("message6",false);go(a)}function go(a){currentpanel=a;setDialogMode(0);QV("showPassHintLink",false);QV("loginpanel",a==1);QV("createpanel",a==2);QV("resetpanel",a==3);QV("tokenpanel",a==4);QV("resettokenpanel",a==5);QV("resetpasswordpanel",a==6);if(a==1){Q("username").focus()}if(a==2){if(features&2097152){Q("aemail").focus()}else{Q("ausername").focus()}}if(a==3){Q("remail").focus()}if(a==4){Q("tokenInput").focus()}if(a==5){Q("resetTokenInput").focus()}if(a==6){Q("rapassword1").focus()}}function validateLogin(a,b){var c=((Q("username").value.length>0)&&(Q("username").value.indexOf(" ")==-1)&&(Q("password").value.length>0));QE("loginButton",c);setDialogMode(0);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("password").focus()}else{if(a==2){Q("loginButton").click()}}}if(b!=null){haltEvent(b)}}function validateCreate(a,b){setDialogMode(0);var c=false;if(features&2097152){c=true}else{c=(Q("ausername").value.length>0)&&(Q("ausername").value.indexOf(" ")==-1)&&(Q("ausername").value.indexOf('"')==-1)&&(Q("ausername").value.indexOf(",")==-1)}c&=((validateEmail(Q("aemail").value)==true)&&(Q("apassword1").value.length>0)&&(Q("apassword2").value==Q("apassword1").value));if((newAccountPass==1)&&(Q("anewaccountpass").value.length==0)){c=false}if(Q("apassword1").value==""){QH("passWarning","");QV("passwordPolicyCallout",false)}else{if(!passRequirementsEx){var f=checkPasswordStrength(Q("apassword1").value);if(f>=80){QH("passWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(f>=60){QH("passWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("passWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var d=checkPasswordRequirements(Q("apassword1").value,passRequirements);if(d==false){c=false;QH("passWarning","<span style=color:red><b>Password Policy</b><span>");QV("passwordPolicyCallout",true);QH("passwordPolicyCallout",passwordPolicyText(Q("apassword1").value))}else{QH("passWarning","");QV("passwordPolicyCallout",false)}}}QE("createButton",c);if((b!=null)&&(b.keyCode==13)){if(a==1){Q("aemail").focus()}if(a==2){Q("apassword1").focus()}if(a==3){Q("apassword2").focus()}if(a==4){Q("apasswordhint").focus()}if(a==5){if(newAccountPass==1){Q("anewaccountpass").focus()}else{Q("createButton").click()}}if(a==6){Q("createButton").click()}}if(b!=null){haltEvent(b)}}function validatePassReset(a,b){setDialogMode(0);var d=(Q("rapassword1").value.length>0);var f=(Q("rapassword2").value.length>0)&&(Q("rapassword2").value==Q("rapassword1").value);var c=(d&&f);QS("rnuPass1").color=d?"black":"#7b241c";QS("rnuPass2").color=f?"black":"#7b241c";if(Q("rapassword1").value==""){QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}else{if(!passRequirementsEx){var h=checkPasswordStrength(Q("rapassword1").value);if(h>=80){QH("rpassWarning","<span style=color:green><b>Strong Password</b><span>")}else{if(h>=60){QH("rpassWarning","<span style=color:blue><b>Good Password</b><span>")}else{QH("rpassWarning","<span style=color:red><b>Weak Password</b><span>")}}}else{var g=checkPasswordRequirements(Q("rapassword1").value,passRequirements);if(g==false){c=false;QS("rnuPass1").color="#7b241c";QS("rnuPass2").color="#7b241c";QH("rpassWarning","<div style=color:red;cursor:pointer onclick=showPasswordPolicy()><b>Password Policy</b><div>");QV("rpasswordPolicyCallout",true);QH("rpasswordPolicyCallout",passwordPolicyText(Q("rapassword1").value))}else{QH("rpassWarning","");QV("rpasswordPolicyCallout",false)}}}if((b!=null)&&(b.keyCode==13)){if(a==2){Q("rapassword1").focus()}if(a==3){Q("rapassword2").focus()}if(a==4){Q("rapasswordhint").focus()}if(a==6){Q("resetPassButton").click()}}if(b!=null){haltEvent(b)}QE("resetPassButton",c)}function validateReset(a){setDialogMode(0);var b=validateEmail(Q("remail").value);QE("eresetButton",b);if((a!=null)&&(a.keyCode==13)&&(b==true)){Q("eresetButton").click()}if(a!=null){haltEvent(a)}}function passwordPolicyText(b){var c="<div style=text-align:left>";var a=strCount(b);if(passRequirements.min&&((b==null)||(b.length<passRequirements.min))){c+="Minimum length of "+passRequirements.min+"<br />"}if(passRequirements.max&&((b==null)||(b.length>passRequirements.max))){c+="Maximum length of "+passRequirements.max+"<br />"}if(passRequirements.upper&&((b==null)||(a.upper<passRequirements.upper))){c+=""+passRequirements.upper+" upper case<br />"}if(passRequirements.lower&&((b==null)||(a.lower<passRequirements.lower))){c+=""+passRequirements.lower+" lower case<br />"}if(passRequirements.numeric&&((b==null)||(a.numeric<passRequirements.numeric))){c+=""+passRequirements.numeric+" numeric<br />"}if(passRequirements.nonalpha&&((b==null)||(a.nonalpha<passRequirements.nonalpha))){c+=passRequirements.nonalpha+" non-alphanumeric<br />"}c+="</div>";return c}function checkPasswordStrength(e){var f=0,d={},g=0,h={digits:/\d/.test(e),lower:/[a-z]/.test(e),upper:/[A-Z]/.test(e),nonWords:/\W/.test(e)};if(!e){return 0}for(var b=0;b<e.length;b++){d[e[b]]=(d[e[b]]||0)+1;f+=5/d[e[b]]}for(var a in h){g+=(h[a]==true)?1:0}return parseInt(f+(g-1)*10)}function checkPasswordRequirements(b,c){if((c==null)||(c=="")||(typeof c!="object")){return true}if(c.min){if(b.length<c.min){return false}}if(c.max){if(b.length>c.max){return false}}var a=strCount(b);if(c.numeric&&(a.numeric<c.numeric)){return false}if(c.lower&&(a.lower<c.lower)){return false}if(c.upper&&(a.upper<c.upper)){return false}if(c.nonalpha&&(a.nonalpha<c.nonalpha)){return false}return true}function strCount(c){var a={numeric:0,lower:0,upper:0,nonalpha:0};if(typeof c!="string"){return a}for(var b=0;b<c.length;b++){if(/\d/.test(c[b])){a.numeric++}if(/[a-z]/.test(c[b])){a.lower++}if(/[A-Z]/.test(c[b])){a.upper++}if(/\W/.test(c[b])){a.nonalpha++}}return a}var xcheckTokenTimer=null;function checkTokenTimer(a){if((a==0)&&(xcheckTokenTimer!=null)){clearInterval(xcheckTokenTimer);xcheckTokenTimer=null}if((a==1)&&(xcheckTokenTimer==null)){xcheckTokenTimer=setInterval(checkToken,200)}}function checkToken(){var a=Q("tokenInput").value,b=a.split(" ").join("");if(a!=b){Q("tokenInput").value=b}QE("tokenOkButton",(Q("tokenInput").value.length==6)||(Q("tokenInput").value.length==8)||(Q("tokenInput").value.length==44))}function resetCheckToken(){var a=Q("resetTokenInput").value,b=a.split(" ").join("");if(a!=b){Q("resetTokenInput").value=b}QE("resetTokenOkButton",(Q("resetTokenInput").value.length==6)||(Q("resetTokenInput").value.length==8)||(Q("resetTokenInput").value.length==44))}var xxdialogMode;var xxdialogFunc;var xxdialogButtons;var xxdialogTag;var xxcurrentView=0;function setDialogMode(j,k,a,e,d,h){xxdialogMode=j;xxdialogFunc=e;xxdialogButtons=a;xxdialogTag=h;QE("idx_dlgOkButton",true);QV("idx_dlgOkButton",a&1);QV("idx_dlgCancelButton",a&2);QV("id_dialogclose",(a&2)||(a&8));QV("idx_dlgButtonBar",a&7);if(k){QH("id_dialogtitle",k)}for(var g=1;g<24;g++){QV("dialog"+g,g==j)}QV("dialog",j);if(d){if(j==2){QH("id_dialogOptions",d)}else{QH("id_dialogMessage",d)}}}function dialogclose(e){var c=xxdialogFunc;var a=xxdialogButtons;var d=xxdialogTag;setDialogMode();if(((a&8)||e)&&c){c(e,d)}}function center(){QS("dialog").left=((((getDocWidth()-400)/2))+"px")}function messagebox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b,1)}function statusbox(b,a){QH("id_dialogMessage",a);setDialogMode(1,b)}function getDocWidth(){if(window.innerWidth){return window.innerWidth}if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}return document.getElementsByTagName("body")[0].clientWidth}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function haltReturn(a){if(a.keyCode==13){haltEvent(a)}}function validateEmail(b){var a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return a.test(b)};</script></body></html> |