CINXE.COM

Visit Singapore Account - Log In

<!DOCTYPE html><html> <head> <title>Visit Singapore Account - Log In</title> <meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link type="text/css" rel="stylesheet" href="/sso/resources/css/bootstrap.min.css"><link type="text/css" rel="stylesheet" href="/sso/resources/fa/css/all.css"><link type="text/css" rel="stylesheet" href="/sso/resources/css/dialog.css"><link rel="icon" href="/sso/resources/images/favicon-16x16.png"><!-- Analytics Header Script --><script src="/sso/resources/js/analytics/header/services/AnalyticsExtendService.js"></script> <script src="/sso/resources/js/analytics/header/constants/AnalyticsConstants.js"></script> <script src="/sso/resources/js/analytics/header/constants/AnalyticsConstants.PAGE_INFO.js"></script> <script src="/sso/resources/js/analytics/header/services/AnalyticsService.js"></script> <script src="/sso/resources/js/analytics/header/services/AnalyticsExtendService.SessionStorage.js"></script> <script src="/sso/resources/js/analytics/header/services/AnalyticsService.Form.js"></script> <script src="/sso/resources/js/analytics/header/services/AnalyticsService.ForgotAccount.js"></script> <script src="/sso/resources/js/analytics/header/header.js"></script> <script src="//assets.adobedtm.com/f9bea43d375e/18bbf49db065/launch-9996385474e9.min.js"></script> <link rel="stylesheet" type="text/css" href="/sso/js/intlTelInput/12.1.4/css/intlTelInput.css"><script type="text/javascript" src="/sso/js/jquery.min.js"></script> <script type="text/javascript" src="/sso/js/bootstrap.min.js"></script> <script type="text/javascript" src="/sso/js/intlTelInput/12.1.4/js/intlTelInput-custom.js"></script> <script type="text/javascript" src="/sso/js/intlTelInput/12.1.4/js/utils.js"></script> <script type="text/javascript" src="/sso/js/URI.js"></script> <script type="text/javascript" src="/sso/js/intlTelInput/12.1.4/js/libphonenumber-max.js"></script> <script type="text/javascript" src="/sso/js/forge.min.js"></script> <style type="text/css"> .hide { display: none!important; } .feedback { width: 100%; margin-top: .25rem; font-size: 80%; color: #f44336; } .banner-notification .alert { margin-bottom: 0; padding: 4px; background: #ffffff; position: fixed; width: 100%; left: 0; z-index: 10; font-size: 15px; } .banner-notification .close { float: right; color: #000000; font-size: 22px; } </style> </head> <body> <!--<div class="container banner-notification"> <div class="alert fade show" role="alert"> To find out more about SingapoRewards and your eligibility, please click <a href="https://singaporewards.visitsingapore.com/" target="_blank">here</a>. <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> </div>--><div class="ie-flex-fix"> <div class="vsdialog-holder"> <div class="vsdialog"> <ul class="nav nav-tabs mb-3 hide" role="tablist"> <li class="nav-item" role="presentation"> <a class="nav-link" id="initialScreenLinkId" data-mdb-toggle="tab" href="#initialScreen" role="tab" ></a> </li> <li class="nav-item" role="presentation"> <a class="nav-link" id="loginScreenLinkId" data-mdb-toggle="tab" href="#loginScreen" role="tab" ></a> </li> <li class="nav-item" role="presentation"> <a class="nav-link" id="errorScreenLinkId" data-mdb-toggle="tab" href="#errorScreen" role="tab" ></a> </li> </ul> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="initialScreen"> <noscript> <div class="row"> <div class="col-md-12 text-center"> <p>Please enable javascript to access this page</p> </div> </div> </noscript> <div class="row"> <div class="col-md-12 text-center"> <img src="/sso/images/vsa-loader.gif" style="display:none;" onload="((this && this.style && this.style.display) ? (this.style.display = 'inline') : '')" onerror="((this && this.style && this.style.display) ? (this.style.display = 'inline') : '')"></div> </div> </div> <div role="tabpanel" class="tab-pane" id="loginScreen"> <div class="vsdialog-header"> <div class="row no-gutters"> <div class="col-sm-3 col-xm-12"> <div class="stb-logo"></div> </div> <div class="col-sm-9 col-xm-12"> <div class="login-message"> <h4> <b>Log In to your Visit Singapore Account</b> </h4> <p>Own your Singapore experience, with personalisation at your fingertips.</p> </div> </div> </div> </div> <div class="vsdialog-content"> <div class="row no-gutters"> <div class="col-sm-6 col-xm-12 email-login"> <form method="post" id="fm1"> <div class="form-group"> <input id="hidden-username-input" style="display:none;" type="text" name="username" value=""/><input id="email-mobile-field" type="text" class="form-control no-danger" placeholder="Email or Mobile Number"/><div id="login-form-username-error-msgs" class="hide"></div> </div> <div class="form-group"> <input id="hidden-password-input" style="display:none;" type="password" name="password" value=""/><input id="password-field" type="password" class="form-control no-danger" placeholder="Password" autocomplete="off" /><div id="login-form-password-error-msgs" class="hide"></div> </div> <div id="login-form-global-error-msgs" class="form-group alert alert-danger hide"></div> <div class="form-group"> <button id="vsidSignInButton" type="submit" class="btn d-none btn-raised btn-danger w-100" accesskey="l" value="Sign-In"> <span class="text-capitalize">Sign-In</span> </button> <a id="updatePasswordButton" href="/sso/updatePassword" class="btn d-none btn-raised btn-danger w-100"></a> <button id="loginFormSubmitBtn" class="btn btn-raised btn-danger w-100">Sign-In</button> <input type="hidden" name="execution" value="0043c180-4d62-466f-bb44-0eaf44632710_ZXlKaGJHY2lPaUpJVXpVeE1pSjkuUTFONGJVd3lVVE01VkV4aWFtWldWRUp2ZW0xTFJFeE9ORE5zZWtweFRUWkZSWFpCVW5KcFR6WmFWMWs1WnpGQ1ZsQkxNRTlhVm5wS1JYWnpabFJ0ZUc0MlZGZHJjRzFJTTJwUWJ5dHdZV1ZFVERWQlZuQmxWekZuU0ZKQk5XWkVkbFJqUmtKeFozaHpZbnAwUWxoclNIQnZTVWQzUzJkaFRXODJiM1p1ZEU5NVRtZHlhRU14U2xOcWIyUXpVRFphZGtJNGJGaHhUVk5rYzI1SlVsQklUazQ0U0hKUlRqTmFaMFYwUW1sM09HUkVUbGxFUkhWTEsycDVia3hGTUdodlVGVm5MMUJDU25ZMWNEa3hiaXN5Y0RSVGExbHFSelZvY0V0Rk5rNVphVmswU1dwSGVDdHRUVTlQTW01cVVUUkNhWGt5Y0UxbFFURlVXR1JuVFVOSk5WWk5jVzlqYmpjM05qWldkemhHT1RaMU5DOVBiMHBTWW5WelIwNWphMngzUkU5VVluZENjRFoxYW10TFJFNHlRV05TZEc5REwwVTFUVGgzU1RsQ1pGSXdRell3YTNOQ2VIVXpRaXR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3dfRmxOa19vOWZLVUNzLTlYbGp4S2JObkdIb1NOM0pvQnM1RTUyaGZ1WUZvZENQQ2dHYWR3VzVubk84QzJDVUprdFB4TkxVVFBxUQ==" /><input type="hidden" name="_eventId" value="submit" /><input type="hidden" name="geolocation" /></div> <div class="text-right"> <a href="/sso/resetPassword" class="text-muted"><small>Forgot Password?</small></a> </div> </form> </div> <div class="col-sm-6 col-xm-12 social-login"> <div class="social-icon-list"> <a id="vsidSignInWithFacebook" href="https://www.facebook.com/v2.5/dialog/oauth?client_id=300836650767793&amp;redirect_uri=https%3A%2F%2Faccount.visitsingapore.com%2Fsso%2Flogin%3Fclient_name%3DFacebookClient&amp;scope=user_likes%2Cuser_about_me%2Cuser_birthday%2Cuser_education_history%2Cemail%2Cuser_hometown%2Cuser_relationship_details%2Cuser_location%2Cuser_religion_politics%2Cuser_relationships%2Cuser_website%2Cuser_work_history&amp;state=3227e60ce8" class="social-login-button facebook-icon"> Continue with Facebook </a> <a id="vsidSignInWithApple" href="https://appleid.apple.com/auth/authorize?response_type=code&amp;client_id=sg.gov.stb.visitsingapore.web&amp;response_mode=form_post&amp;redirect_uri=https%3A%2F%2Faccount.visitsingapore.com%2Fsso%2Flogin%3Fclient_name%3DAppleOidcClient&amp;scope=openid+name+email&amp;state=NfSd9z7m1jk9H5isp-RygOEYizZ_Cbsl24VPixlYye4" class="social-login-button apple-icon"> Sign in with Apple</a> <a id="vsidSignInWithGoogle" href="https://accounts.google.com/o/oauth2/auth?response_type=code&amp;client_id=1006955686532-7cpsloof9main2dcnprte79s1rf8bngt.apps.googleusercontent.com&amp;redirect_uri=https%3A%2F%2Faccount.visitsingapore.com%2Fsso%2Flogin%3Fclient_name%3DGoogle2Client&amp;scope=profile%20email&amp;state=b10e373d7b" class="social-login-button google-icon"> Sign in with Google </a> </div> </div> <div class="login-or-text">OR</div> </div> </div> </div> <div role="tabpanel" class="tab-pane" id="errorScreen"> <div class="row"> <div class="col-md-12 text-center"> <p id="errorScreenMsg">An unexpected error occurred. Please click the button below or reload the page to try again.</p> </div> </div> <div class="row mb-2"> <div class="col-md-12 text-center"> <button id="errorScreenTryAgainButton" class="btn btn-danger btn-raised" disabled>Try Again</button> </div> </div> </div> </div> <div class="vsdialog-footer"> <small> <a href="/sso/register">Create An Account</a> </small> </div> </div> </div> </div> <script type="text/javascript"> var COMMON_UTILS = (function($){ var CSRF_TOKEN_HOLDER_ID = "pageCSRFToken"; var CSRF_TOKEN_HEADER_HOLDER_ID = "pageCSRFTokenHeader"; var DEFAULT_CSRF_TOKEN_HEADER_VALUE = "X-CSRF-TOKEN"; var INVALID_NUMBER_TYPE = -99; var MOBILE_NUMBER_TYPE = 1; var MOBILE_NUMBER_TYPE_STRING = "MOBILE"; var FIXED_LINE_OR_MOBILE_NUMBER_TYPE_STRING = "FIXED_LINE_OR_MOBILE"; function isEmptyString(str){ return (typeof(str) !== "string" || str.length <= 0); } function hasStatusCode(statusCode) { return typeof(statusCode) === "number" || !isEmptyString(statusCode); } function getCSRFToken(fallback) { var token = $("#" + CSRF_TOKEN_HOLDER_ID).attr("content"); if(isEmptyString(token)){ token = fallback; } return token; } function getCSRFTokenHeader(fallback) { var tokenHeader = $("#" + CSRF_TOKEN_HEADER_HOLDER_ID).attr("content"); if(isEmptyString(tokenHeader)){ tokenHeader = fallback; } return tokenHeader; } function addPlusAtStartIfAbsent(val) { if(isEmptyString(val)){ return val; } if(val.charAt(0) !== '+'){ return "+" + val; } else { return val; } } function getFullNumberForNumberType(dialCode, telNum, isSeparateDialCode) { if(isEmptyString(telNum)){ telNum = ""; } if(isEmptyString(dialCode)){ return telNum; } return addPlusAtStartIfAbsent(dialCode) + telNum; } function removePlusAtStartIfPresent(val) { if(isEmptyString(val)){ return val; } if(val.charAt(0) === '+'){ if(val.length < 2){ return ""; } else { return val.substring(1); } } else { return val; } } function getNumberTypeInternal(phoneNumObj) { if(!phoneNumObj){ return INVALID_NUMBER_TYPE; } var phoneNumType = phoneNumObj.getType(); if(phoneNumType === MOBILE_NUMBER_TYPE_STRING || phoneNumType === FIXED_LINE_OR_MOBILE_NUMBER_TYPE_STRING){ return MOBILE_NUMBER_TYPE; } else { return INVALID_NUMBER_TYPE; } } function getNumberType(dialCode, number, selectedCountryCodeInISO2, isSeparateDialCode) { try { if (!libphonenumber) { return INVALID_NUMBER_TYPE; } if(isEmptyString(dialCode)){ dialCode = ""; } dialCode = removePlusAtStartIfPresent(dialCode); if(isEmptyString(number)){ number = ""; } isSeparateDialCode = isSeparateDialCode === true; if(isEmptyString(selectedCountryCodeInISO2)){ return getNumberTypeInternal(libphonenumber.parsePhoneNumber( getFullNumberForNumberType(dialCode, number, isSeparateDialCode) )); } try { return getNumberTypeInternal(libphonenumber.parsePhoneNumber( getFullNumberForNumberType(dialCode, number, isSeparateDialCode), selectedCountryCodeInISO2.toUpperCase() )); } catch(ex){ console.log("getNumberType => during parsing of phone number with country code ex =", ex); return getNumberTypeInternal(libphonenumber.parsePhoneNumber( getFullNumberForNumberType(dialCode, number, isSeparateDialCode) )); } } catch(e){ console.log("getNumberType => e =", e); } return INVALID_NUMBER_TYPE; } return { "isEmptyString": isEmptyString, "getStringErrorObj": function(code, text) { return { "xhrCode": code, "xhrText": text } }, "getStatusCodeFromErrorObj": function(errorObj) { if(!errorObj){ return undefined; } return errorObj["xhrCode"]; }, "getStatusTextFromErrorObj": function(errorObj) { if(!errorObj){ return undefined; } return errorObj["xhrText"]; }, "hasStatusCode": hasStatusCode, "getFormattedErrorMsgWithCode": function(errorCode) { if(!hasStatusCode(errorCode)){ return "An unexpected error occurred. Please try again."; } return "An unexpected error (code: " + errorCode + ") occurred"; }, "getFormattedErrorMsgWithText": function(errorText, maxLength) { if(isEmptyString(errorText)){ return "An unexpected error occurred."; } if(typeof(maxLength) === "number" && errorText.length > maxLength){ errorText = errorText.substring(0, maxLength) + " ..."; } return "An unexpected error (text: " + errorText + ") occurred." }, "getFormattedErrorCodeForXHR": function(errorCode) { if(!hasStatusCode(errorCode)){ return "VS-001"; } return "VS" + errorCode; }, "switchToTab": function(tabId, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(isEmptyString(tabId)){ callbackFn(); return; } var tab = $("#" + tabId); tab.off('shown.bs.tab').on('shown.bs.tab', function () { tab.off('shown.bs.tab'); callbackFn(); }); tab.tab("show"); }, "setCSRFHeader": function(headers) { if(!headers){ headers = {}; } headers[getCSRFTokenHeader(DEFAULT_CSRF_TOKEN_HEADER_VALUE)] = getCSRFToken(""); return headers }, "refreshPage": function(afterMilliseconds) { if(!window || !window.location || typeof(window.location.reload) !== "function"){ return false; } if(typeof(afterMilliseconds) !== "number" || afterMilliseconds < 0){ afterMilliseconds = 0; } setTimeout(function(){ window.location.reload(true); }, afterMilliseconds); return true; }, "redirectTo": function(url, afterMilliseconds) { if(!window || !window.location){ return false; } if(isEmptyString(url)){ return false; } if(typeof(afterMilliseconds) !== "number" || afterMilliseconds < 0){ afterMilliseconds = 0; } setTimeout(function(){ window.location.href = url; }, afterMilliseconds); return true; }, "getNumberType": getNumberType, "isMobileNumberType": function(dialCode, number, selectedCountryCodeInISO2, isSeparateDialCode) { try { if (!window.intlTelInputUtils) { return false; } return MOBILE_NUMBER_TYPE === getNumberType( dialCode, number, selectedCountryCodeInISO2, isSeparateDialCode ); } catch(e){ console.log("isMobileNumberType => e =", e); } return false; } } })($); </script> <script type="text/javascript"> var GLOBAL_ERROR_CODES_FACTORY = (function(){ return { "generate": function() { return { "NO_NETWORK_CONNECTIVITY": 0, "SUCCESS": 200, "BAD_REQUEST": 400, "UNAUTHORIZED": 401, "INVALID_NOTIFICATION_OPTION_WHILE_SAVE_CHANGE_NOTIFICATION": -4, "MOBILE_NOTIFICATION_OPTION_NOT_AVAILABLE_WHILE_SAVE_CHANGE_NOTIFICATION": -5, "EMAIL_NOTIFICATION_OPTION_NOT_AVAILABLE_WHILE_SAVE_CHANGE_NOTIFICATION": -6, "USER_NO_LONGER_EXISTS_WHILE_SAVE_CHANGE_NOTIFICATION": -8, "MISSING_RESPONSE_WHILE_SAVE_CHANGE_NOTIFICATION": -14, "MISSING_STATUS_OBJ_WHILE_SAVE_CHANGE_NOTIFICATION": -15, "MISSING_STATUS_CODE_WHILE_SAVE_CHANGE_NOTIFICATION": -16, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_SAVE_CHANGE_NOTIFICATION": -17, "INVALID_RESPONSE_FORMAT_WHILE_SAVE_CHANGE_NOTIFICATION": -18, "INVALID_ERROR_STATUS_WHILE_SAVE_CHANGE_NOTIFICATION": -19, "UNKNOWN_ERROR_WHILE_SAVE_CHANGE_NOTIFICATION": -20, "USER_NO_LONGER_EXISTS_WHILE_GET_NOTIFICATION_OPTIONS": -21, "MISSING_RESPONSE_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -27, "MISSING_STATUS_OBJ_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -28, "MISSING_STATUS_CODE_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -29, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -30, "INVALID_RESPONSE_FORMAT_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -31, "MISSING_DATA_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -32, "INVALID_ERROR_STATUS_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -33, "UNKNOWN_ERROR_WHILE_GET_ALL_NOTIFICATION_OPTIONS": -34, "MISSING_RESPONSE_WHILE_GET_MOBILE_INFO": -41, "MISSING_STATUS_OBJ_WHILE_GET_MOBILE_INFO": -42, "MISSING_STATUS_CODE_WHILE_GET_MOBILE_INFO": -43, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_MOBILE_INFO": -44, "INVALID_RESPONSE_FORMAT_WHILE_GET_MOBILE_INFO": -45, "MISSING_RESPONSE_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -50, "MISSING_STATUS_OBJ_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -51, "MISSING_STATUS_CODE_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -52, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -53, "INVALID_RESPONSE_FORMAT_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -54, "UNKNOWN_ERROR_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -55, "INVALID_ERROR_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -56, "MISSING_DATA_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE": -57, "INVALID_ERROR_STATUS_WHILE_GET_MOBILE_INFO": -58, "UNKNOWN_ERROR_WHILE_GET_MOBILE_INFO": -59, "MISSING_DATA_WHILE_GET_MOBILE_INFO": -60, "EMPTY_MOBILE_PREFIX_WHILE_SAVE_CHANGE_MOBILE": -64, "INVALID_MOBILE_PREFIX_FORMAT_WHILE_SAVE_CHANGE_MOBILE": -65, "MOBILE_PREFIX_NOT_AVAILABLE_WHILE_SAVE_CHANGE_MOBILE": -66, "EMPTY_MOBILE_NUMBER_WHILE_SAVE_CHANGE_MOBILE": -67, "MOBILE_NUMBER_TOO_SHORT_WHILE_SAVE_CHANGE_MOBILE": -68, "MOBILE_NUMBER_TOO_LONG_WHILE_SAVE_CHANGE_MOBILE": -69, "INVALID_MOBILE_NUMBER_FORMAT_WHILE_SAVE_CHANGE_MOBILE": -70, "USER_NO_LONGER_EXISTS_WHILE_SAVE_CHANGE_MOBILE": -72, "MISSING_RESPONSE_WHILE_UPDATE_MOBILE_INFO": -78, "MISSING_STATUS_OBJ_WHILE_UPDATE_MOBILE_INFO": -79, "MISSING_STATUS_CODE_WHILE_UPDATE_MOBILE_INFO": -80, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_UPDATE_MOBILE_INFO": -81, "INVALID_RESPONSE_FORMAT_WHILE_UPDATE_MOBILE_INFO": -82, "UNKNOWN_ERROR_WHILE_UPDATE_MOBILE_INFO": -83, "INVALID_ERROR_STATUS_WHILE_UPDATE_MOBILE_INFO": -84, "MISSING_RESPONSE_WHILE_GENERATING_PUBLIC_KEY": -87, "MISSING_STATUS_OBJ_WHILE_GENERATING_PUBLIC_KEY": -88, "MISSING_STATUS_CODE_WHILE_GENERATING_PUBLIC_KEY": -89, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GENERATING_PUBLIC_KEY": -90, "INVALID_RESPONSE_FORMAT_WHILE_GENERATING_PUBLIC_KEY": -91, "INVALID_ERROR_STATUS_WHILE_GENERATING_PUBLIC_KEY": -92, "UNKNOWN_ERROR_WHILE_GENERATING_PUBLIC_KEY": -93, "MISSING_PUBLIC_KEY_WHILE_GENERATING_PUBLIC_KEY": -94, "MISSING_TXN_UUID_WHILE_GENERATING_PUBLIC_KEY": -95, "UNABLE_TO_ENCRYPT_PASSWORD_WHILE_GENERATING_PUBLIC_KEY": -96, "MISSING_RESPONSE_WHILE_VALIDATING_SSO": -97, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_VALIDATING_SSO": -98, "INVALID_RESPONSE_FORMAT_WHILE_VALIDATING_SSO": -99, "MISSING_RESPONSE_WHILE_CHECK_IF_IM8_COMPLIANT": -100, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_CHECK_IF_IM8_COMPLIANT": -101, "INVALID_RESPONSE_FORMAT_WHILE_CHECK_IF_IM8_COMPLIANT": -102, "UNABLE_TO_ENCRYPT_CURRENT_PASSWORD_WHILE_UPDATING_PASSWORD": -103, "UNABLE_TO_ENCRYPT_NEW_PASSWORD_WHILE_UPDATING_PASSWORD": -104, "UNABLE_TO_ENCRYPT_CONFIRM_PASSWORD_WHILE_UPDATING_PASSWORD": -105, "UNABLE_TO_ENCRYPT_PASSWORD_WHILE_REGISTRATION": -106, "UNABLE_TO_ENCRYPT_CONFIRM_PASSWORD_WHILE_REGISTRATION": -107, "UNABLE_TO_ENCRYPT_PASSWORD_WHILE_CHANGE_PASSWORD": -109, "UNABLE_TO_ENCRYPT_CONFIRM_PASSWORD_WHILE_CHANGE_PASSWORD": -110 } } }; })(); </script> <script> (function($, COMMON_UTILS, GLOBAL_ERROR_CODES, FORM_HANDLER){ var ERROR_SCREEN_MSG_ID = "errorScreenMsg"; var ERROR_SCREEN_TRY_AGAIN_BUTTON_ID = "errorScreenTryAgainButton"; var EMAIL_OR_MOBILE_INPUT_FIELD = "email-mobile-field"; var HIDDEN_USER_NAME_INPUT_ID = "hidden-username-input"; var INITIAL_SCREEN_TAB_LINK_ID = "initialScreenLinkId"; var LOGIN_SCREEN_TAB_LINK_ID = "loginScreenLinkId"; var ERROR_SCREEN_TAB_LINK_ID = "errorScreenLinkId"; var LOGIN_FORM_SUBMIT_BTN_ID = "loginFormSubmitBtn"; var PASSWORD_INPUT_FIELD_ID = "password-field"; var GLOBAL_ERROR_MSG_CONTAINER_ID = "login-form-global-error-msgs"; var ALT_GLOBAL_ERROR_MSG_CONTAINER_ID = "alt-login-form-global-error-msgs"; var USERNAME_ERROR_MSG_CONTAINER_ID = "login-form-username-error-msgs"; var ALT_USERNAME_ERROR_MSG_CONTAINER_ID = "alt-login-form-username-error-msgs"; var PASSWORD_ERROR_MSG_CONTAINER_ID = "login-form-password-error-msgs"; var ALT_PASSWORD_ERROR_MSG_CONTAINER_ID = "alt-login-form-password-error-msgs"; var SOCIAL_LOGIN_ERROR_MSG_CONTAINER_ID = "social-login-global-error-msgs"; var COUNTRY_DIAL_CODE_NOT_AVAILABLE = "The selected country dial code is not available. Please select another country dial code."; var NO_NETWORK_CONNECTIVITY_ERROR_MSG = "Please try again when you have network connectivity."; var DEFAULT_ERROR_SCREEN_TAB_MSG = "An unexpected error occurred. Please click the button below or reload the page to try again."; var DEFAULT_ERROR_MSG = "An unexpected error occurred. Please try again later."; var EMPTY_USERNAME_ERROR_MSG = "Please enter an email or mobile number."; var EMPTY_PASSWORD_ERROR_MSG = "Please enter a password."; var MOBILE_NUMBER_PREFIX_COMPONENT_KEY = "prefix"; var MOBILE_NUMBER_COMPONENT_KEY = "mobile"; var PUBLIC_KEY_IN_PUBLIC_KEY_OBJ_KEY = "publicKey"; var TXN_UUID_IN_PUBLIC_KEY_OBJ_KEY = "uuid"; var GEO_LOCATION_URL = "https://api.ipbase.com/v2/info?apikey="; var GEO_LOCATION_API_KEY = "71a76fc0-621e-11ec-a256-d187a4bfcd19"; var GEO_LOCATION_FULL_URL = GEO_LOCATION_URL + GEO_LOCATION_API_KEY; var UPDATE_URL = "/sso/updatePassword"; var UPDATE_URL_EMAIL_QUERY_NAME = "email"; var UPDATE_URL_PHONE_QUERY_NAME = "phone"; var UPDATE_URL_USERNAME_QUERY_NAME = "username"; var DEFAULT_COUNTRY_CODE = "SG"; var PHONE_NUMBER_REGEX = /^\+?[0-9]+$/; var HIDDEN_PHONE_NUMBER_VALUE_REGEX = /^\+[0-9]+ [0-9]+$/; var HIDDEN_PHONE_NUMBER_PREFIX_VALUE_REGEX = /^\+[0-9]+$/; var HAS_INITIALIZED_PHONE_NUMBER_FIELD = false; var VALID_INPUT_CLASS_VALUE = "no-danger"; var INVALID_INPUT_CLASS_VALUE = "is-invalid"; var TOUCHED_DATA_ATTRIBUTE_NAME = "data-touched"; var TOUCHED_DATA_ATTRIBUTE_VALUE = "true"; var UNTOUCHED_DATA_ATTRIBUTE_VALUE = "false"; var ENTER_KEY_CODE = 13; var PHONE_TYPE_USERNAME = "phoneUsername"; var EMAIL_TYPE_USERNAME = "emailUsername"; function isEnterKeyEvent(evt) { if(!evt){ return false; } return evt["keyCode"] === ENTER_KEY_CODE; } function onFieldKeyDown(evt) { if(isEnterKeyEvent(evt)){ onLoginFormSubmitBtnClick(); stopPropagation(evt); } } function unTouchAllFields() { setFieldUnTouched($("#" + EMAIL_OR_MOBILE_INPUT_FIELD)); setFieldUnTouched($("#" + PASSWORD_INPUT_FIELD_ID)); } function isFieldTouched(field) { return $(field).attr(TOUCHED_DATA_ATTRIBUTE_NAME) === TOUCHED_DATA_ATTRIBUTE_VALUE; } function setFieldTouched(field) { return $(field).attr(TOUCHED_DATA_ATTRIBUTE_NAME, TOUCHED_DATA_ATTRIBUTE_VALUE); } function setFieldUnTouched(field) { return $(field).attr(TOUCHED_DATA_ATTRIBUTE_NAME, UNTOUCHED_DATA_ATTRIBUTE_VALUE); } function onUserNameFieldFocus() { var userNameField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); if(!isFieldTouched(userNameField)){ setFieldTouched(userNameField); } else { hideErrorMsgForUsernameField(); } } function onUserNameFieldBlur() { validateUserName(function(isValid){ if(isValid === true){ hideErrorMsgForUsernameField(); } }); } function setupUserNameField() { var userNameField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); userNameField.off("keydown", onFieldKeyDown).on("keydown", onFieldKeyDown); userNameField.off("focus", onUserNameFieldFocus).on("focus", onUserNameFieldFocus); userNameField.off("blur", onUserNameFieldBlur).on("blur", onUserNameFieldBlur); } function onPasswordFieldFocus() { var passwordField = $("#" + PASSWORD_INPUT_FIELD_ID); if(!isFieldTouched(passwordField)){ setFieldTouched(passwordField); } else { hideErrorMsgForPasswordField(); } } function onPasswordFieldBlur() { validatePassword(function(isValid){ if(isValid === true){ hideErrorMsgForPasswordField(); } }); } function setupPasswordField() { var passwordField = $("#" + PASSWORD_INPUT_FIELD_ID); passwordField.off("keydown", onFieldKeyDown).on("keydown", onFieldKeyDown); passwordField.off("focus", onPasswordFieldFocus).on("focus", onPasswordFieldFocus); passwordField.off("blur", onPasswordFieldBlur).on("blur", onPasswordFieldBlur); } function hideAllErrors() { hideErrorMsgForUsernameField(); hideErrorMsgForPasswordField(); $("#" + GLOBAL_ERROR_MSG_CONTAINER_ID).addClass("hide"); $("#" + ALT_GLOBAL_ERROR_MSG_CONTAINER_ID).addClass("hide"); $("#" + SOCIAL_LOGIN_ERROR_MSG_CONTAINER_ID).addClass("hide"); } function hideErrorMsgForPasswordField() { hideFieldErrorMsg( $("#" + PASSWORD_INPUT_FIELD_ID), $("#" + PASSWORD_ERROR_MSG_CONTAINER_ID), $("#" + ALT_PASSWORD_ERROR_MSG_CONTAINER_ID) ); } function hideErrorMsgForUsernameField() { hideFieldErrorMsg( $("#" + EMAIL_OR_MOBILE_INPUT_FIELD), $("#" + USERNAME_ERROR_MSG_CONTAINER_ID), $("#" + ALT_USERNAME_ERROR_MSG_CONTAINER_ID) ); } function hideFieldErrorMsg(input, errorMsgContainer, altErrorMsgContainer) { input = $(input); input.removeClass(INVALID_INPUT_CLASS_VALUE); input.addClass(VALID_INPUT_CLASS_VALUE); $(errorMsgContainer).addClass("hide"); $(altErrorMsgContainer).addClass("hide"); } function showErrorMsgForUsernameField(msg) { showFieldErrorMsg( $("#" + EMAIL_OR_MOBILE_INPUT_FIELD), $("#" + USERNAME_ERROR_MSG_CONTAINER_ID), $("#" + ALT_USERNAME_ERROR_MSG_CONTAINER_ID), msg ); } function showErrorMsgForPasswordField(msg) { showFieldErrorMsg( $("#" + PASSWORD_INPUT_FIELD_ID), $("#" + PASSWORD_ERROR_MSG_CONTAINER_ID), $("#" + ALT_PASSWORD_ERROR_MSG_CONTAINER_ID), msg ); } function showFieldErrorMsg(input, errorMsgContainer, altErrorMsgContainer, msg) { input = $(input); input.removeClass(VALID_INPUT_CLASS_VALUE); input.addClass(INVALID_INPUT_CLASS_VALUE); if(!showErrorMsgInMsgContainer(altErrorMsgContainer, msg, "feedback")){ showErrorMsgInMsgContainer(errorMsgContainer, msg, "feedback"); } } function showErrorMsgInMsgContainer(container, msg, additionalMsgClass) { if(COMMON_UTILS.isEmptyString(msg)){ msg = DEFAULT_ERROR_MSG; } container = $(container); if(container.length <= 0){ return false; } container.addClass("hide"); container.empty(); var additionalProps = {}; if(!COMMON_UTILS.isEmptyString(additionalMsgClass)){ additionalProps["class"] = additionalMsgClass; } var msgElement = $("<p>", additionalProps); msgElement.text(msg); container.append(msgElement); container.removeClass("hide"); return true; } function showGlobalErrorMsg(msg) { if(!showErrorMsgInMsgContainer($("#" + ALT_GLOBAL_ERROR_MSG_CONTAINER_ID), msg)){ showErrorMsgInMsgContainer($("#" + GLOBAL_ERROR_MSG_CONTAINER_ID), msg); } } function disableInteractionInErrorTab() { var tryAgainBtn = $("#" + ERROR_SCREEN_TRY_AGAIN_BUTTON_ID); tryAgainBtn.prop("disabled", true); return function() { tryAgainBtn.prop("disabled", false); } } function enableInteractionInErrorTab() { var tryAgainBtn = $("#" + ERROR_SCREEN_TRY_AGAIN_BUTTON_ID); tryAgainBtn.prop("disabled", false); return function() { tryAgainBtn.prop("disabled", true); } } function switchToInitialScreenTab(callbackFn) { disableInteractionInErrorTab(); COMMON_UTILS.switchToTab(INITIAL_SCREEN_TAB_LINK_ID, callbackFn); } function switchToLoginTab(callbackFn) { disableInteractionInErrorTab(); COMMON_UTILS.switchToTab(LOGIN_SCREEN_TAB_LINK_ID, callbackFn); } function switchToErrorScreenTab(callbackFn) { enableInteractionInErrorTab(); COMMON_UTILS.switchToTab(ERROR_SCREEN_TAB_LINK_ID, callbackFn); } function disableUI() { var loginFormSubmitBtn = $("#" + LOGIN_FORM_SUBMIT_BTN_ID); loginFormSubmitBtn.prop("disabled", true); var usernameInputField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); usernameInputField.prop("disabled", true); var passwordInputField = $("#" + PASSWORD_INPUT_FIELD_ID); passwordInputField.prop("disabled", true); return function() { usernameInputField.prop("disabled", false); passwordInputField.prop("disabled", false); loginFormSubmitBtn.prop("disabled", false); } } function getFullPhoneNumber(prefix, number) { var isPrefixEmpty = COMMON_UTILS.isEmptyString(prefix); var isNumberEmpty = COMMON_UTILS.isEmptyString(number); if(!isPrefixEmpty && !isNumberEmpty){ return prefix + " " + number; } else if(!isPrefixEmpty) { return prefix; } else if(!isNumberEmpty) { return number; } else { return ""; } } function retrieveUserName(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var phoneInputField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var phoneInputValue = phoneInputField.val(); if(isPhoneNumberInput(phoneInputValue)){ var components = getMobileNumberComponents(); if(!components){ components = {}; } var phoneNumberPrefix = components[MOBILE_NUMBER_PREFIX_COMPONENT_KEY]; if(COMMON_UTILS.isEmptyString(phoneNumberPrefix)){ phoneNumberPrefix = ""; } else { phoneNumberPrefix = addPlusAtTheFrontIfAbsent(phoneNumberPrefix); } var phoneNumber = components[MOBILE_NUMBER_COMPONENT_KEY]; if(COMMON_UTILS.isEmptyString(phoneNumber)){ phoneNumber = ""; } callbackFn(true, getFullPhoneNumber(phoneNumberPrefix, phoneNumber), PHONE_TYPE_USERNAME); } else { callbackFn(true, phoneInputValue, EMAIL_TYPE_USERNAME); } } function encryptPassword(psd, pem) { try { if(COMMON_UTILS.isEmptyString(psd)){ return ""; } if(COMMON_UTILS.isEmptyString(pem)){ return ""; } //using forge.min.js var pki = forge.pki; var publicKey = pki.publicKeyFromPem(pem); var encrypted = publicKey.encrypt(psd, 'RSA-OAEP', { md: forge.md.sha256.create(), mgf1: { md: forge.md.sha1.create() } }); return btoa(encrypted); } catch(e){ console.log("encryptPassword() => e =", e); } return ""; } function validateUserName(callbackFn){ if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var isValid = true; var userNameField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var userNameValue = userNameField.val(); if(COMMON_UTILS.isEmptyString(userNameValue)){ showErrorMsgForUsernameField(EMPTY_USERNAME_ERROR_MSG); isValid = false; } else if(isPhoneNumberInput(userNameValue)) { var countryDialCode = getCountryDialCode(userNameField.intlTelInput("getSelectedCountryData")); if(COMMON_UTILS.isEmptyString(countryDialCode)){ showErrorMsgForUsernameField(COUNTRY_DIAL_CODE_NOT_AVAILABLE); isValid = false; } } if(isValid === true){ hideErrorMsgForUsernameField(); } callbackFn(isValid); } function validatePassword(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var isValid = true; var passwordField = $("#" + PASSWORD_INPUT_FIELD_ID); var passwordValue = passwordField.val(); if(COMMON_UTILS.isEmptyString(passwordValue)){ showErrorMsgForPasswordField(EMPTY_PASSWORD_ERROR_MSG); isValid = false; } if(isValid === true){ hideErrorMsgForPasswordField(); } callbackFn(isValid); } function areValidFields(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var isValid = true; validateUserName(function(isValidUsername){ if(isValidUsername !== true){ isValid = false; } validatePassword(function(isValidPassword){ if(isValidPassword !== true){ isValid = false; } callbackFn(isValid); }); }); } function retrieveEncryptedPassword(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var passwordInputField = $("#" + PASSWORD_INPUT_FIELD_ID); var passwordInputValue = passwordInputField.val(); generatePublicKey(function(code, data){ onGeneratePublicKey(code, data, function(isSuccess, keyObj){ if(isSuccess !== true){ callbackFn(false); } var publicKey = keyObj[PUBLIC_KEY_IN_PUBLIC_KEY_OBJ_KEY]; if(COMMON_UTILS.isEmptyString(publicKey)){ showGlobalErrorMsg( generateErrorMsgWithCodeForLoginScreenTab( GLOBAL_ERROR_CODES["MISSING_PUBLIC_KEY_WHILE_GENERATING_PUBLIC_KEY"] ) ); callbackFn(false); return; } var txUuid = keyObj[TXN_UUID_IN_PUBLIC_KEY_OBJ_KEY]; if(COMMON_UTILS.isEmptyString(txUuid)) { showGlobalErrorMsg( generateErrorMsgWithCodeForLoginScreenTab( GLOBAL_ERROR_CODES["MISSING_TXN_UUID_WHILE_GENERATING_PUBLIC_KEY"] ) ); callbackFn(false); return; } if(COMMON_UTILS.isEmptyString(passwordInputValue)){ callbackFn(true, "", txUuid); return; } var encryptedPsd = encryptPassword(passwordInputValue, publicKey); if(COMMON_UTILS.isEmptyString(encryptedPsd)){ showGlobalErrorMsg( generateErrorMsgWithCodeForLoginScreenTab( GLOBAL_ERROR_CODES["UNABLE_TO_ENCRYPT_PASSWORD_WHILE_GENERATING_PUBLIC_KEY"] ) ); callbackFn(false); return; } callbackFn(true, encryptedPsd, txUuid); }) }); } function triggerUpdateEvent(userName, usernameType) { if(COMMON_UTILS.isEmptyString(UPDATE_URL)){ return false; } if(COMMON_UTILS.isEmptyString(userName)){ return false; } var uri = URI(UPDATE_URL); uri.setSearch(UPDATE_URL_USERNAME_QUERY_NAME, userName); /* if(usernameType === PHONE_TYPE_USERNAME){ uri.setSearch(UPDATE_URL_PHONE_QUERY_NAME, userName); } else { uri.setSearch(UPDATE_URL_EMAIL_QUERY_NAME, userName); }*/ return COMMON_UTILS.redirectTo(uri.toString()); } function onLoginFormSubmitBtnClick() { var reEnableUI = disableUI(); if(typeof(reEnableUI) !== "function"){ reEnableUI = function(){}; } unTouchAllFields(); hideAllErrors(); areValidFields(function(isValid){ if(isValid !== true){ reEnableUI(); return; } retrieveUserName(function(isRetrieveUserNameSuccess, userName, usernameType){ if(isRetrieveUserNameSuccess !== true){ reEnableUI(); return; } retrieveEncryptedPassword(function(isRetrieveEncryptedPsdSuccess, encryptedPsd, txnUuid){ if(isRetrieveEncryptedPsdSuccess !== true){ reEnableUI(); return; } checkIfValidSSO(userName, encryptedPsd, txnUuid, function(isValidateSSOSuccess, isValidSSO){ if(isValidateSSOSuccess !== true){ FORM_HANDLER.submit(userName, encryptedPsd, txnUuid); return; } if(isValidSSO !== true){ FORM_HANDLER.submit(userName, encryptedPsd, txnUuid); return; } triggerCheckIfIM8Compliant(userName, encryptedPsd, txnUuid, function(isCheckIfIM8CompliantSuccess, isIM8Compliant){ if(isCheckIfIM8CompliantSuccess !== true){ FORM_HANDLER.submit(userName, encryptedPsd, txnUuid); return; } if(isIM8Compliant === true || !triggerUpdateEvent(userName, usernameType)){ FORM_HANDLER.submit(userName, encryptedPsd, txnUuid); } }); }); }); }); }); } function stopPropagation(ev) { try { if(!ev){ console.log("stopPropagation() => ev =", ev); return; } ev.preventDefault(); ev.stopPropagation(); } catch(e){ console.log("stopPropagation() => e =", e); } } function setupLoginFormSubmitBtn() { var loginFormSubmitBtn = $("#" + LOGIN_FORM_SUBMIT_BTN_ID); loginFormSubmitBtn.off("click").on("click", function(ev){ onLoginFormSubmitBtnClick(); stopPropagation(ev); }); } function onTryAgainBtnClick() { var reEnableUIFn = disableInteractionInErrorTab(); if(typeof(reEnableUIFn) !== "function"){ reEnableUIFn = function(){}; } switchToInitialScreenTab(function(){ setupMobile(function(isSuccess){ if(isSuccess !== true){ switchToErrorScreenTab(); } else { recoverInputs(function(){ switchToLoginTab(); }); } }); }); } function setupTryAgainBtn() { var tryAgainBtn = $("#" + ERROR_SCREEN_TRY_AGAIN_BUTTON_ID); tryAgainBtn.off("click").on("click", function(){ onTryAgainBtnClick(); }); } function getValueFormTextInputField(textInputField) { if(!textInputField){ return ""; } var textInputValue = $(textInputField).val(); if(COMMON_UTILS.isEmptyString(textInputValue)){ return ""; } else { return textInputValue; } } function getCorrectedMobileNumber(mobileNumber) { if(COMMON_UTILS.isEmptyString(mobileNumber)){ return mobileNumber; } return mobileNumber.replace(/(\s|-|\(|\))/g, ""); } function getCorrectedMobilePrefix(mobilePrefix) { return addPlusAtTheFrontIfAbsent(mobilePrefix); } function getCountryCode(countryData) { if(!countryData){ return ""; } var countryCode = countryData["iso2"]; if(COMMON_UTILS.isEmptyString(countryCode)){ return ""; } else { return countryCode; } } function updateUserNameFlagFromNumber(userNameField, number) { if(!userNameField || COMMON_UTILS.isEmptyString(number)){ return; } userNameField = $(userNameField); var selectedCountryCode = getCountryCode(userNameField.intlTelInput("getSelectedCountryData")); userNameField.intlTelInput("updateFlagFromNumber", number); var afterChangedCountryCode = getCountryCode(userNameField.intlTelInput("getSelectedCountryData")); if(COMMON_UTILS.isEmptyString(afterChangedCountryCode) && !COMMON_UTILS.isEmptyString(selectedCountryCode)){ userNameField.intlTelInput("setCountry", selectedCountryCode) } } function recoverUserNameInput() { var userNameField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var hiddenUsernameField = $("#" + HIDDEN_USER_NAME_INPUT_ID); var hiddenUsernameValue = getValueFormTextInputField(hiddenUsernameField); var setAsPerUsual = function(value) { userNameField.val(value); setFlagContainerVisibility(); }; if(HIDDEN_PHONE_NUMBER_PREFIX_VALUE_REGEX.test(hiddenUsernameValue)){ userNameField.val(hiddenUsernameValue); updateUserNameFlagFromNumber(userNameField, hiddenUsernameValue); setFlagContainerVisibility(); return; } else if(!HIDDEN_PHONE_NUMBER_VALUE_REGEX.test(hiddenUsernameValue)){ setAsPerUsual(hiddenUsernameValue); return; } var phoneNumberComponents = getPhoneNumberComponents(hiddenUsernameValue); if(!phoneNumberComponents){ phoneNumberComponents = {}; } var prefix = getCorrectedMobilePrefix(phoneNumberComponents[MOBILE_NUMBER_PREFIX_COMPONENT_KEY]); var number = getCorrectedMobileNumber(phoneNumberComponents[MOBILE_NUMBER_COMPONENT_KEY]); if(!COMMON_UTILS.isEmptyString(prefix) && !COMMON_UTILS.isEmptyString(number)){ userNameField.val(number); updateUserNameFlagFromNumber(userNameField, prefix + number); setFlagContainerVisibility(); } else if(!COMMON_UTILS.isEmptyString(prefix)) { userNameField.val(prefix); updateUserNameFlagFromNumber(userNameField, prefix); setFlagContainerVisibility(); } else if(!COMMON_UTILS.isEmptyString(number)) { userNameField.val(number); setFlagContainerVisibility(); } else { setAsPerUsual(hiddenUsernameValue); } } function recoverInputs(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } recoverUserNameInput(); callbackFn(); } function setup(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } setupUserNameField(); setupPasswordField(); setupLoginFormSubmitBtn(); setupTryAgainBtn(); setupMobile(callbackFn); } function setupMobile(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } setupMobileNumberField(callbackFn); } function setupMobileNumberField(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(HAS_INITIALIZED_PHONE_NUMBER_FIELD === true){ callbackFn(true); return; } getAllCountriesWithPrefix(function(code, data){ onGetAllCountriesWithPrefix(code, data, function(isSuccess){ if(isSuccess === true){ HAS_INITIALIZED_PHONE_NUMBER_FIELD = true; } callbackFn(isSuccess); }); }); } function generateMobileNumberComponents(prefix, mobile) { var components = {}; components[MOBILE_NUMBER_PREFIX_COMPONENT_KEY] = prefix; components[MOBILE_NUMBER_COMPONENT_KEY] = mobile; return components; } function getCountryDialCode(countryData) { if(!countryData){ return ""; } var countryDialCode = countryData["dialCode"]; if(COMMON_UTILS.isEmptyString(countryDialCode)){ return ""; } else { return countryDialCode; } } function addPlusAtTheFrontIfAbsent(str) { if(COMMON_UTILS.isEmptyString(str)){ return str; } if(str[0] !== "+"){ return "+" + str; } else { return str; } } function getPhoneNumberComponents(value) { if(COMMON_UTILS.isEmptyString(value)){ return generateMobileNumberComponents("", ""); } var firstSpaceIndex = value.indexOf(" "); if(firstSpaceIndex < 0 || firstSpaceIndex >= value.length){ return generateMobileNumberComponents(value, ""); } var prefix = value.substring(0, firstSpaceIndex); if(firstSpaceIndex + 1 >= value.length){ return generateMobileNumberComponents(prefix, ""); } var number = value.substring(firstSpaceIndex + 1); return generateMobileNumberComponents(prefix, number); } function getMobileNumberComponents() { var mobileNumberField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var number = mobileNumberField.val(); var countryDialCode = getCountryDialCode(mobileNumberField.intlTelInput("getSelectedCountryData")); var isNumberEmpty = COMMON_UTILS.isEmptyString(number); var isCountryDialCodeEmpty = COMMON_UTILS.isEmptyString(countryDialCode); if(isNumberEmpty && isCountryDialCodeEmpty){ return generateMobileNumberComponents("", ""); } else if(isNumberEmpty) { return generateMobileNumberComponents(addPlusAtTheFrontIfAbsent(countryDialCode), ""); } else if(isCountryDialCodeEmpty) { return generateMobileNumberComponents("", number); } var correctedCountryDialCode = addPlusAtTheFrontIfAbsent(countryDialCode); if(COMMON_UTILS.isEmptyString(correctedCountryDialCode)){ correctedCountryDialCode = ""; } if(number.length < correctedCountryDialCode.length){ return generateMobileNumberComponents(correctedCountryDialCode, number); } var frontOfNumber = number.substring(0, correctedCountryDialCode.length); if(COMMON_UTILS.isEmptyString(frontOfNumber)){ return generateMobileNumberComponents(correctedCountryDialCode, number); } if(frontOfNumber.toLowerCase() !== correctedCountryDialCode.toLowerCase()){ return generateMobileNumberComponents(correctedCountryDialCode, number); } if(correctedCountryDialCode.length > number.length){ return generateMobileNumberComponents(correctedCountryDialCode, number); } else if(correctedCountryDialCode.length === number.length) { return generateMobileNumberComponents(correctedCountryDialCode, ""); } var reducedNumber = number.substring(correctedCountryDialCode.length); if(COMMON_UTILS.isEmptyString(reducedNumber)){ reducedNumber = ""; } return generateMobileNumberComponents(correctedCountryDialCode, reducedNumber); } function isPhoneNumberInput(phoneInputValue) { return typeof(phoneInputValue) === "string" && phoneInputValue.length > 0 && PHONE_NUMBER_REGEX.test(phoneInputValue); } function isShowFlagContainer(phoneInputValue) { return isPhoneNumberInput(phoneInputValue); } function setFlagContainerVisibility() { var phoneInputField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var phoneInputValue = phoneInputField.val(); if(!isShowFlagContainer(phoneInputValue)){ phoneInputField.intlTelInput("hideFlagContainer"); } else { phoneInputField.intlTelInput("showFlagContainer"); } } function addTimeoutToFn(fn) { if(typeof(fn) !== "function"){ return fn; } var that = this; return function() { var args = arguments; setTimeout(function(){ fn.apply(that, args); }); } } function initMobileNumberField(data, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } callbackFn = addTimeoutToFn(callbackFn); if(!data){ data = {}; } var dataList = data["allCountriesWithPrefix"]; if(!Array.isArray(dataList)){ dataList = []; } var countryPrefixArray = []; var countryCodeMap = {}; for(var i = 0; i < dataList.length; ++i){ var allCountriesForPrefixItem = dataList[i]; if(!allCountriesForPrefixItem){ continue; } var countryCode = allCountriesForPrefixItem["countryCode"]; if(typeof(countryCode) !== "string" || countryCode.length <= 0){ continue; } countryPrefixArray.push(countryCode); countryCodeMap[countryCode.toUpperCase()] = true; } var mobileNumberField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); mobileNumberField.intlTelInput({ "onlyCountries": countryPrefixArray, "preferredCountries": [DEFAULT_COUNTRY_CODE], "formatOnDisplay": false, "autoHideDialCode": true, "initialCountry": "auto", "isShowFlagContainerOnInit": function() { var phoneInputField = $("#" + EMAIL_OR_MOBILE_INPUT_FIELD); var phoneInputValue = phoneInputField.val(); return isShowFlagContainer(phoneInputValue); }, "onInputChange": function() { setFlagContainerVisibility(); }, "geoIpLookup": function(success) { if(COMMON_UTILS.isEmptyString(GEO_LOCATION_URL) || COMMON_UTILS.isEmptyString(GEO_LOCATION_API_KEY) || COMMON_UTILS.isEmptyString(GEO_LOCATION_FULL_URL)){ success(DEFAULT_COUNTRY_CODE); callbackFn(true); return; } $.ajax({ "url": GEO_LOCATION_FULL_URL, "type": "GET", "dataType": 'json', "success": function (data) { if (!data) { success(DEFAULT_COUNTRY_CODE); callbackFn(true); return; } var countryCode = data["country_code"]; if (typeof(countryCode) !== "string" || countryCode.length <= 0) { success(DEFAULT_COUNTRY_CODE); callbackFn(true); return; } var upperCaseCountryCode = countryCode.toUpperCase(); var isValidCountryCode = countryCodeMap[upperCaseCountryCode]; if (isValidCountryCode !== true) { success(DEFAULT_COUNTRY_CODE); callbackFn(true); return; } console.log("GEO LOCATION CountryCode =", upperCaseCountryCode); success(upperCaseCountryCode); callbackFn(true); }, "error": function (err, textStatus, errorThrown) { success(DEFAULT_COUNTRY_CODE); callbackFn(true); } }); } }); } function onGetAllCountriesWithPrefix(code, data, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(code === GLOBAL_ERROR_CODES["SUCCESS"]){ if(!data){ setErrorMsgInErrorScreenTab( generateErrorMsgWithCodeForErrorScreenTab( GLOBAL_ERROR_CODES["MISSING_DATA_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"] ) ); showInteractionsInErrorScreenTab(); callbackFn(false); } else { initMobileNumberField(data, callbackFn); } } else if(code === GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"] || code === GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"]) { var statusCode = COMMON_UTILS.getStatusCodeFromErrorObj(data); var statusText = COMMON_UTILS.getStatusTextFromErrorObj(data); if(statusCode === GLOBAL_ERROR_CODES["NO_NETWORK_CONNECTIVITY"]){ setErrorMsgInErrorScreenTab(NO_NETWORK_CONNECTIVITY_ERROR_MSG); showInteractionsInErrorScreenTab(); callbackFn(false); } else if(COMMON_UTILS.hasStatusCode(statusCode)){ setErrorMsgInErrorScreenTab(generateErrorMsgWithCodeForErrorScreenTab(statusCode)); showInteractionsInErrorScreenTab(); callbackFn(false); } else if(!COMMON_UTILS.isEmptyString(statusText)){ setErrorMsgInErrorScreenTab(statusText); showInteractionsInErrorScreenTab(); callbackFn(false); } else { setErrorMsgInErrorScreenTab( generateErrorMsgWithCodeForErrorScreenTab( GLOBAL_ERROR_CODES["INVALID_ERROR_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"] ) ); showInteractionsInErrorScreenTab(); callbackFn(false); } } else if(typeof(code) === "number") { setErrorMsgInErrorScreenTab(generateErrorMsgWithCodeForErrorScreenTab(code)); showInteractionsInErrorScreenTab(); callbackFn(false); } else { setErrorMsgInErrorScreenTab( generateErrorMsgWithCodeForErrorScreenTab( GLOBAL_ERROR_CODES["UNKNOWN_ERROR_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"] ) ); showInteractionsInErrorScreenTab(); callbackFn(false); } } function setErrorMsgInErrorScreenTab(errorMsg) { if(COMMON_UTILS.isEmptyString(errorMsg)){ errorMsg = DEFAULT_ERROR_SCREEN_TAB_MSG; } $("#" + ERROR_SCREEN_MSG_ID).text(errorMsg); } function generateErrorMsgWithCodeForErrorScreenTab(code) { if(typeof(code) !== "number" && typeof(code) !== "string"){ return DEFAULT_ERROR_SCREEN_TAB_MSG; } return "An unexpected error (code: " + code + ") occurred. Please click the below button or reload the page to try again."; } function generateErrorMsgWithCodeForLoginScreenTab(code) { if(typeof(code) !== "number" && typeof(code) !== "string"){ return DEFAULT_ERROR_MSG; } return "An unexpected error (code: " + code + ") occurred."; } function showInteractionsInErrorScreenTab() { $("#" + ERROR_SCREEN_TRY_AGAIN_BUTTON_ID).removeClass("hide"); } function onGeneratePublicKey(code, data, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(code === GLOBAL_ERROR_CODES["SUCCESS"]){ callbackFn(true, data); } else if(code === GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GENERATING_PUBLIC_KEY"] || code === GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_GENERATING_PUBLIC_KEY"]) { var statusCode = COMMON_UTILS.getStatusCodeFromErrorObj(data); var statusText = COMMON_UTILS.getStatusTextFromErrorObj(data); if(statusCode === GLOBAL_ERROR_CODES["NO_NETWORK_CONNECTIVITY"]){ showGlobalErrorMsg(NO_NETWORK_CONNECTIVITY_ERROR_MSG); callbackFn(false); } else if(COMMON_UTILS.hasStatusCode(statusCode)){ showGlobalErrorMsg(generateErrorMsgWithCodeForLoginScreenTab(statusCode)); callbackFn(false); } else if(!COMMON_UTILS.isEmptyString(statusText)){ showGlobalErrorMsg(statusText); callbackFn(false); } else { showGlobalErrorMsg( generateErrorMsgWithCodeForLoginScreenTab( GLOBAL_ERROR_CODES["INVALID_ERROR_STATUS_WHILE_GENERATING_PUBLIC_KEY"] ) ); callbackFn(false); } } else if(typeof(code) === "number") { showGlobalErrorMsg(generateErrorMsgWithCodeForLoginScreenTab(code)); callbackFn(false); } else { showGlobalErrorMsg( generateErrorMsgWithCodeForLoginScreenTab( GLOBAL_ERROR_CODES["UNKNOWN_ERROR_WHILE_GENERATING_PUBLIC_KEY"] ) ); callbackFn(false); } } function checkIfIM8Compliant(username, encryptedPsd, txnUuid, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var data = { "username": username, "password": encryptedPsd, "txnUuid": txnUuid }; $.ajax({ url: "/sso/checkIM8Compliant", contentType: 'application/x-www-form-urlencoded;charset=UTF-8', type: 'POST', data: data, dataType: 'json', success: function(data) { console.log("checkIfIM8Compliant() success => data =", data); if(typeof(data) !== "boolean"){ callbackFn(GLOBAL_ERROR_CODES["MISSING_RESPONSE_WHILE_CHECK_IF_IM8_COMPLIANT"]); return; } callbackFn(GLOBAL_ERROR_CODES["SUCCESS"], data); }, error: function(xhr) { console.log("checkIfIM8Compliant() error => xhr =", xhr); if(xhr && xhr["status"] === GLOBAL_ERROR_CODES["SUCCESS"] && typeof(xhr["responseText"]) === "string"){ callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_CHECK_IF_IM8_COMPLIANT"], COMMON_UTILS.getStringErrorObj(xhr["status"], xhr["responseText"]) ); } else if(xhr && typeof(xhr["status"]) === "number") { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_CHECK_IF_IM8_COMPLIANT"], COMMON_UTILS.getStringErrorObj(xhr["status"], "") ); } else { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_CHECK_IF_IM8_COMPLIANT"] ); } } }); } function onCheckIfIM8Compliant(code, data, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(code === GLOBAL_ERROR_CODES["SUCCESS"]){ callbackFn(true, data); } else { callbackFn(false); } } function triggerCheckIfIM8Compliant(username, encryptedPsd, txnUuid, callbackFn) { checkIfIM8Compliant(username, encryptedPsd, txnUuid, function(code, data){ onCheckIfIM8Compliant(code, data, callbackFn); }); } function checkIfValidSSO(username, encryptedPsd, txnUuid, callbackFn) { validateSSO(username, encryptedPsd, txnUuid, function(code, data){ onValidateSSO(code, data, callbackFn); }) } function onValidateSSO(code, data, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } if(code === GLOBAL_ERROR_CODES["SUCCESS"]){ callbackFn(true, data); } else { callbackFn(false); } } function validateSSO(username, encryptedPsd, txnUuid, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var data = { "username": username, "password": encryptedPsd, "txnUuid": txnUuid }; $.ajax({ url: "/sso/validate", contentType: 'application/x-www-form-urlencoded;charset=UTF-8', type: 'POST', data: data, dataType: 'json', success: function(data) { console.log("validateSSO() success => data =", data); if(typeof(data) !== "boolean"){ callbackFn(GLOBAL_ERROR_CODES["MISSING_RESPONSE_WHILE_VALIDATING_SSO"]); return; } callbackFn(GLOBAL_ERROR_CODES["SUCCESS"], data); }, error: function(xhr) { console.log("validateSSO() error => xhr =", xhr); if(xhr && xhr["status"] === GLOBAL_ERROR_CODES["SUCCESS"] && typeof(xhr["responseText"]) === "string"){ callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_VALIDATING_SSO"], COMMON_UTILS.getStringErrorObj(xhr["status"], xhr["responseText"]) ); } else if(xhr && typeof(xhr["status"]) === "number") { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_VALIDATING_SSO"], COMMON_UTILS.getStringErrorObj(xhr["status"], "") ); } else { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_WHILE_VALIDATING_SSO"] ); } } }); } function generatePublicKey(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } $.ajax({ url: "/sso/generatePublicKey", contentType: 'application/json;charset=utf-8', type: 'POST', dataType: 'json', success: function(data) { console.log("generatePublicKey() success => data =", data); if(!data){ callbackFn(GLOBAL_ERROR_CODES["MISSING_RESPONSE_WHILE_GENERATING_PUBLIC_KEY"]); return; } var status = data["status"]; if(!status){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_OBJ_WHILE_GENERATING_PUBLIC_KEY"]); return; } var statusCode = status["code"]; if(typeof(statusCode) !== "number"){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_CODE_WHILE_GENERATING_PUBLIC_KEY"]); return; } callbackFn(statusCode, data["data"]); }, error: function(xhr) { console.log("generatePublicKey() error => xhr =", xhr); if(xhr && xhr["status"] === GLOBAL_ERROR_CODES["SUCCESS"] && typeof(xhr["responseText"]) === "string"){ callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GENERATING_PUBLIC_KEY"], COMMON_UTILS.getStringErrorObj(xhr["status"], xhr["responseText"]) ); } else if(xhr && typeof(xhr["status"]) === "number") { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GENERATING_PUBLIC_KEY"], COMMON_UTILS.getStringErrorObj(xhr["status"], "") ); } else { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_GENERATING_PUBLIC_KEY"] ); } } }); } function getAllCountriesWithPrefix(callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } $.ajax({ url: "/sso/get_all_countries_for_mobile", contentType: 'application/json;charset=utf-8', type: 'GET', dataType: 'json', success: function(data) { console.log("getAllCountriesWithPrefix() success => data =", data); if(!data){ callbackFn(GLOBAL_ERROR_CODES["MISSING_RESPONSE_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"]); return; } var status = data["status"]; if(!status){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_OBJ_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"]); return; } var statusCode = status["code"]; if(typeof(statusCode) !== "number"){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_CODE_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"]); return; } callbackFn(statusCode, data["data"]); }, error: function(xhr) { console.log("getAllCountriesWithPrefix() error => xhr =", xhr); if(xhr && xhr["status"] === GLOBAL_ERROR_CODES["SUCCESS"] && typeof(xhr["responseText"]) === "string"){ callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"], COMMON_UTILS.getStringErrorObj(xhr["status"], xhr["responseText"]) ); } else if(xhr && typeof(xhr["status"]) === "number") { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"], COMMON_UTILS.getStringErrorObj(xhr["status"], "") ); } else { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_GET_ALL_COUNTRIES_FOR_MOBILE"] ); } } }); } $(document).ready(function(){ setup(function(isSuccess){ if(isSuccess !== true){ switchToErrorScreenTab(); } else { recoverInputs(function(){ switchToLoginTab(); }); } }); }); })($, COMMON_UTILS, GLOBAL_ERROR_CODES_FACTORY.generate(), (function($, COMMON_UTILS){ var LOGIN_FORM_ELEMENT_ID = "fm1"; var HIDDEN_USER_NAME_INPUT_ID = "hidden-username-input"; var HIDDEN_PASSWORD_INPUT_ID = "hidden-password-input"; var TXN_UUID_QUERY_NAME = "txnUuid"; var ACTION_FORM_ATTRIBUTE_NAME = "action"; function getCurrentUrl() { if(!window || !window.location){ return ""; } var url = window.location.href; if(COMMON_UTILS.isEmptyString(url)){ return ""; } else { return url; } } function getPostUrl(txnUuid) { if(COMMON_UTILS.isEmptyString(txnUuid)){ return ""; } var currentUrl = getCurrentUrl(); if(COMMON_UTILS.isEmptyString(currentUrl)){ return ""; } var uri = URI(currentUrl); uri.setSearch(TXN_UUID_QUERY_NAME, txnUuid); return uri.toString(); } function submit(userName, password, txnUuid) { var formElement = $("#" + LOGIN_FORM_ELEMENT_ID); var hiddenUsernameElement = $("#" + HIDDEN_USER_NAME_INPUT_ID); var hiddenPasswordElement = $("#" + HIDDEN_PASSWORD_INPUT_ID); if(COMMON_UTILS.isEmptyString(userName)){ userName = ""; } if(COMMON_UTILS.isEmptyString(password)){ password = ""; } if(COMMON_UTILS.isEmptyString(txnUuid)){ txnUuid = ""; } hiddenUsernameElement.val(userName); hiddenPasswordElement.val(password); formElement.attr(ACTION_FORM_ATTRIBUTE_NAME, getPostUrl(txnUuid)); formElement.submit(); } return { "submit": submit }; })($, COMMON_UTILS)); </script> <script> /*<![CDATA[*/ AnalyticsService.ForgotAccount.trackFormSubmissionSuccess(); /*]]>*/ </script> <div class="footer"> <div class="container"> <div class="row"> <div class="col-md-8"> <div> <span>Copyright &copy; 2019 Singapore Tourism Board.</span> <a href="/sso/termsofuse" >Terms of Use</a> <a target="_blank" href="https://www.visitsingapore.com/privacy/" >Privacy</a> <a target="_blank" href="https://www.visitsingapore.com/contact-us/">Contact Us</a> </div> </div> <div class="col-md-4"> <!-- <div> <a th:href="@{https://s.visitsingapore.com/contact-us.html}">Contact Us</a> </div> --></div> </div> </div> </div> </body> <script type='text/javascript' src="/sso/resources/js/jquery-3.6.0.min.js"></script> <script type='text/javascript' src="/sso/resources/js/popper.min.js"></script> <script type='text/javascript' src="/sso/resources/js/bootstrap.min.js"></script> <script> $(document).ready(function(){ }); </script> <script src="/sso/resources/js/analytics/footer/footer.js"></script> </html>

Pages: 1 2 3 4 5 6 7 8 9 10