File Manager
Viewing File: login-ib.js.download
$(document).ready(function(){var e=$("#login-button");if($("form").unbind("submit"),$(".capslock-warning").hide(),ibLoginValidator.disableIECapslockWarningIfPresent(),$("#password").keypress(function(e){ibLoginValidator.updateCapslockWarning(e)}),$("#complexErrorBox").length>0){var n=$("#complexErrorBox .sg-Box-content p").html();BTAnalytics.register_values(BTAnalytics.register_values({errors:[n]}))}$("#J_exitInternetBanking").on("click",function(e){e.preventDefault(),window.close()}),e.click(function(){initEnsightenDataModel(),dataLayer.dataModel.uama.loginType="bk_selfservice_ib_login","undefined"!=typeof webAnalytics&&webAnalytics.publish("event","loginclicked")}),$("#loginForm").on("submit",function(e){var n=$("input[name='username']"),i=!1,o=!1,t=!1,s=n.val().rtrim();n.val(s);var r=$("input[name='password']").val(),a=$("input[name='passcode']").val();$("#complexErrorBox").length>0&&$("#complexErrorBox").remove(),$("#simpleErrorBox").hide(),$("#simpleErrorBox .sg-Box-content p").remove(),i=ibLoginValidator.isCidValid(s),o=ibLoginValidator.isPasswordValid(r),t=ibLoginValidator.isTokenValid(a),BTAnalytics.register_values({events:["sa | bk | login | forgot | link | customer_id"]}),"undefined"!=typeof webAnalytics&&webAnalytics.publish("event","sa | bk | login | submit"),i&&o&&t?sg.overlay():(BTAnalytics.register_values({events:["VALIDATION_ERROR"],pageName:"bk:sun:secapp:ib:authentication:login_err",errors:["This is an invalid combination of Internet Banking Customer ID, Internet Banking Password and Token Code - please re-enter your details. Your Internet Banking password is case sensitive so ensure your CAPS lock is not on. <strong>If you have a security token or use the Suncorp Secured App you must enter a token code to login.</strong>"]}),"undefined"!=typeof webAnalytics&&webAnalytics.publish("event","page_view"),$("#simpleErrorBox").show(),$("#simpleErrorBox .sg-Box-content").append("<p>This is an invalid combination of Internet Banking Customer ID, Internet Banking Password and Token Code - please re-enter your details. Your Internet Banking password is case sensitive so ensure your CAPS lock is not on. <strong>If you have a security token or use the Suncorp Secured App you must enter a token code to login.</strong></p>"),e.preventDefault())}),$("span[data-content-id='#whatAreSecurityTokens']").on("click",function(e){e.preventDefault(),e.stopPropagation(),BTAnalytics.register_values({events:["sa | bk | login | forgot | link | security_token"]}),"undefined"!=typeof webAnalytics&&webAnalytics.publish("event","sa | bk | login | forgot | link | security_token")})});var ibLoginValidator={updateCapslockWarning:function(e){kc=e.keyCode?e.keyCode:e.which,sk=e.shiftKey?e.shiftKey:16==kc,kc>=65&&kc<=90&&!sk||kc>=97&&kc<=122&&sk?$(".capslock-warning").show():$(".capslock-warning").hide()},isCidValid:function(e){return e.length>=8&&e.length<=10&&this.isNumberOnly(e)},isPasswordValid:function(e){return e.length>0},isTokenValid:function(e){return 0==e.length||e.length<=8&&this.isNumberOnly(e)},isNumberOnly:function(e){return/^[0-9]+$/.test(e)},disableIECapslockWarningIfPresent:function(){0==document.msCapsLockWarningOff&&(document.msCapsLockWarningOff=!0)}};