CINXE.COM
Forget Password | Singapore Tourism Board
<!DOCTYPE html><style> .btn.rounded-pill { border-radius: 50rem !important; } </style> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="icon" href="/iamsso/favicon.ico" type="image/x-icon"/><title>Forget Password | Singapore Tourism Board</title> <link type="text/css" rel="stylesheet" href="/iamsso/css/bootstrap.min.css"><link type="text/css" rel="stylesheet" href="/iamsso/css/font-awesome.min.css"><link type="text/css" rel="stylesheet" href="/iamsso/css/animate.css"><link type="text/css" rel="stylesheet" href="/iamsso/css/screen.css"><script type="text/javascript" src="/iamsso/js/jquery.min.js"></script> <script type="text/javascript" src="/iamsso/js/bootstrap.min.js"></script> <script type="text/javascript" src="/iamsso/js/uri.min.js"></script> <script type="text/javascript" src="/iamsso/js/jsencrypt.js"></script> <script src="//www.google.com/recaptcha/api.js" async defer></script> </head> <body> <div class="simpleLoginHolder"> <div class="container"> <div class="masterFormHolder"> <header class="simpleLoginHolderHeader"> <div class="siteLogoHolder"> <a href="https://tih.stb.gov.sg/content/tih/en/home.html" class="siteLogo"> <div class="siteLogoInfo"> <img src="/iamsso/images/tih-logo.svg" alt="Logo"></div> </a> </div> </header> <div class="tab-content"> <div id="errorMessageAlert" class="col-sm-12 alert alert-danger" style="display:none"></div> <div style="display: none"> <a id="gotoTabLinkId" href="#section-Thankyou" role="tab" data-toggle="tab">goToTabLink</a> </div> <div role="tabpanel" class="tab-pane" id="section-Thankyou"> <div class="inputSectionHolder"> <div class="inputSectionHeader text-center"> <h3 class="inputTitleHeading">Thank you</h3> </div> <div class="inputSectionBody"> <div class="loginContentHolder"> <h5 class="text-center text-primary" id="successMsg">To reset your password, please follow the instructions sent to your email.</h5> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane active"> <form method="post" id="forgotPasswordForm"> <div class="inputSectionHolder"> <div class="inputSectionHeader text-center"> <h3 class="inputTitleHeading">Forgot Password?</h3> </div> <div class="inputSectionBody"> <div class="row"> <div class="col-sm-10 col-sm-offset-1"> <div class="form-group"> <label>Enter your email address below and we will email you instructions.</label> <input class="form-control" placeholder="Email Address" id="email" name="email" type="email" value="" required="required"><div id="invalidEmailError" class="col-sm-12 alert alert-danger" style="display:none;">error</div> </div> </div> </div> <div class="row"> <div class="col-sm-10 col-sm-offset-1"> <label>Please complete the Captcha below.</label> <div id="recaptcha-element" class="g-recaptcha" style="padding-bottom:10px;" data-sitekey="6Lc8gREaAAAAAPLQDwm2avt3IdKMHcyhLc9xiFJ_"> </div> <div id="captchaError" class="col-sm-12 alert alert-danger" style="display:none">Error</div> </div> </div> </div> <div class="inputSectionFooter"> <div class="btnHolder"> <div class="row"> <div class="col-xs-12 col-sm-6 col-sm-offset-3"> <button id="submitButton" class="btn btn-green rounded-pill" type="button">Submit</button> </div> </div> </div> </div> <div class="formLoginBottomInfo"> <p class="text-center">Need Help? Please <a id="contactUsLink" target="_blank" href="https://tih.stb.gov.sg/content/tih/en/header/contact-info.html">Contact Us</a>.</p> <p class="text-center">Back to <a href="https://tih-iam.stb.gov.sg/iamsso/login?service=https%3A%2F%2Ftih.stb.gov.sg%2Fbin%2FloginValidation">Sign In</a>.</p> </div> </div> </form> </div> </div> </div> </div> </div> <script type="text/javascript"> var GLOBAL_ERROR_CODES_FACTORY = (function(){ return { "generate": function() { return { "NO_NETWORK_CONNECTIVITY": 0, "SUCCESS": 200, "USER_NOT_FOUND_WHILE_AUTHENTICATING_USER": -99, "EMPTY_USER_NAME_WHILE_AUTHENTICATING_USER": -94, "EMPTY_PASSWORD_WHILE_AUTHENTICATING_USER": -95, "CP_USER_WHILE_AUTHENTICATING_USER": -958, "SP_USER_WHILE_AUTHENTICATING_USER": -959, "LOCKED_USER_ACCOUNT_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -132, "DISABLED_USER_ACCOUNT_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -133, "BLOCKED_USER_ACCOUNT_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -134, "REGISTERED_USER_ACCOUNT_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -137, "NOT_ACTIVE_USER_ACCOUNT_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -138, "EXPIRED_PASSWORD_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -141, "ACCOUNT_LOCKED_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -142, "INVALID_USERNAME_PASSWORD_COMBINATION_DURING_USER_CREDENTIAL_VALIDATION_WHILE_AUTHENTICATING_USER": -143, "MISSING_ENTRY_URL_WHILE_RETRIEVE_LOGIN_INIT_DATA": -940, "MISSING_PARAMETERS_WHILE_RETRIEVE_LOGIN_INIT_DATA": -941, "MISSING_RESPONSE_WHILE_RETRIEVE_LOGIN_INIT_DATA": -942, "MISSING_STATUS_WHILE_RETRIEVE_LOGIN_INIT_DATA": -943, "MISSING_STATUS_CODE_WHILE_RETRIEVE_LOGIN_INIT_DATA": -944, "INVALID_RESPONSE_FORMAT_WHILE_RETRIEVE_LOGIN_INIT_DATA": -945, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_RETRIEVE_LOGIN_INIT_DATA": -946, "INVALID_ERROR_STATUS_WHILE_RETRIEVE_LOGIN_INIT_DATA": -947, "MISSING_RESPONSE_WHILE_INIT_LOGIN": -948, "MISSING_STATUS_WHILE_INIT_LOGIN": -949, "MISSING_STATUS_CODE_WHILE_INIT_LOGIN": -950, "MISSING_DATA_WHILE_INIT_LOGIN": -951, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_INIT_LOGIN": -952, "INVALID_RESPONSE_FORMAT_WHILE_INIT_LOGIN": -953, "INVALID_ERROR_STATUS_WHILE_INIT_LOGIN": -954, "UNKNOWN_ERROR_WHILE_INIT_LOGIN": -955, "MISSING_REDIRECT_UUID_WHILE_INIT_LOGIN": -956, "MISSING_ACTION_WHILE_INIT_LOGIN": -957, "MISSING_RESPONSE_WHILE_GET_PUBLIC_KEY": -1336, "MISSING_STATUS_WHILE_GET_PUBLIC_KEY": -1337, "MISSING_STATUS_CODE_WHILE_GET_PUBLIC_KEY": -1338, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_PUBLIC_KEY": -1339, "INVALID_RESPONSE_FORMAT_WHILE_GET_PUBLIC_KEY": -1340, "MISSING_DATA_WHILE_GET_PUBLIC_KEY": -1341, "MISSING_PUBLIC_KEY_WHILE_GET_PUBLIC_KEY": -1342, "MISSING_TX_UUID_WHILE_GET_PUBLIC_KEY": -1343, "UNABLE_TO_ENCRYPT_KEY_WHILE_ENCRYPTING_KEY": -1344, "EMPTY_ENCRYPTED_KEY_WHILE_ENCRYPTING_KEY": -1345, "INVALID_ACTIVATION_TOKEN": -1365, "ALREADY_LOGIN": -1366, "EMPTY_PASSWORD": -1410, "COMMON_PASSWORD": -1411, "PASSWORD_NOT_COMPLIANT": -1412, "PASSWORD_SAME_AS_USERNAME": -1413, "PASSWORD_IN_HISTORY": -1414, "MISSING_RESPONSE_WHILE_SET_NEW_PSSD": -1415, "MISSING_STATUS_WHILE_SET_NEW_PSSD": -1416, "MISSING_STATUS_CODE_WHILE_SET_NEW_PSSD": -1417, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_SET_NEW_PSSD": -1418, "INVALID_RESPONSE_FORMAT_WHILE_SET_NEW_PSSD": -1419, "MISSING_DATA_WHILE_SET_NEW_PSSD": -1427, "INVALID_ERROR_STATUS_WHILE_SET_NEW_PSSD": -1428, "UNKNOWN_ERROR_WHILE_SET_NEW_PSSD": -1429, "UNKNOWN_STATUS_CODE_WHILE_SET_NEW_PSSD": -1430, "MISSING_PASSWORD_TOKEN_OBJ_WHILE_ACTIVATE_ACCOUNT": -1483, "MISSING_USER_WHILE_ACTIVATE_ACCOUNT": -1487, "USER_ALREADY_ACTIVATED": -1526, "USER_NOT_ABLE_TO_LOGIN": -1527, "USER_NEED_TO_RESET_PASSWORD": -1528, "USER_NO_LONGER_EXISTS": -1529, "IS_CORPPASS_LOGIN": -1530, "IS_SINGPASS_LOGIN": -1531, "EMPTY_USERNAME_WHILE_LOGIN": -1545, "EMPTY_PASSWORD_WHILE_LOGIN": -1546, "EMPTY_PASSWORD_WHILE_ACTIVATION": -1547, "INVALID_CURRENT_PASSWORD_WHILE_CHANGE_PASSWORD": -1566, "UNABLE_TO_CONFORM_NEW_PASSWORD_WHILE_CHANGE_PASSWORD": -1571, "MISSING_RESPONSE_WHILE_CHANGE_PASSWORD": -1572, "MISSING_STATUS_WHILE_CHANGE_PASSWORD": -1573, "MISSING_STATUS_CODE_WHILE_CHANGE_PASSWORD": -1574, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_CHANGE_PASSWORD": -1575, "INVALID_RESPONSE_FORMAT_WHILE_CHANGE_PASSWORD": -1576, "PASSWORD_TOO_COMMON_WHILE_CHANGE_PASSWORD": -1582, "MISSING_RESPONSE_WHILE_GENERATE_CAPTCHA": -1614, "MISSING_STATUS_WHILE_GENERATE_CAPTCHA": -1615, "MISSING_STATUS_CODE_WHILE_GENERATE_CAPTCHA": -1616, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GENERATE_CAPTCHA": -1617, "INVALID_RESPONSE_FORMAT_WHILE_GENERATE_CAPTCHA": -1618, "MISSING_CAPTCHA_WHILE_OFFLINE_ACTIVATE": -1655, "INVALID_CAPTCHA_WHILE_OFFLINE_ACTIVATE": -1656, "MISSING_PIN_WHILE_OFFLINE_ACTIVATE": -1657, "MISSING_PASSWORD_TOKEN_WHILE_OFFLINE_ACTIVATE": -1658, "INVALID_USER_STATUS_WHILE_OFFLINE_ACTIVATE": -1661, "MISSING_RESPONSE_WHILE_OFFLINE_ACTIVATE": -1667, "MISSING_STATUS_WHILE_OFFLINE_ACTIVATE": -1668, "MISSING_STATUS_CODE_WHILE_OFFLINE_ACTIVATE": -1669, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_OFFLINE_ACTIVATE": -1670, "INVALID_RESPONSE_FORMAT_WHILE_OFFLINE_ACTIVATE": -1671, "MISSING_RESPONSE_WHILE_FORGET_PASSWORD": -2012, "MISSING_STATUS_WHILE_FORGET_PASSWORD": -2013, "MISSING_STATUS_CODE_WHILE_FORGET_PASSWORD": -2014, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_FORGET_PASSWORD": -2015, "INVALID_RESPONSE_FORMAT_WHILE_FORGET_PASSWORD": -2016, "SESSION_FOUND_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE": -2022, "UNKNOWN_ERROR_WHILE_SUBMITTING_FORGET_PASSWORD": -2023, "INCORRECT_GOOGLE_CAPTCHA": -2024, "MISSING_VALIDATE_CATPCHA_STATUS_WHILE_FORGET_PASSWORD": -2025, "MISSING_USER_WHILE_FORGET_PASSWORD": -2026, "INVALID_USER_ACCOUNT_STATUS": -2030, "MISSING_EMAIL_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE": -2039, "MISSING_RECAPTCHA_RESPONSE_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE": -2040, "INVALID_DUE_TO_REGISTERED_ACCOUNT_STATUS": -2042, "ACCOUNT_TYPE_NOT_PL_WHILE_FORGET_PASSWORD": -2043, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2121, "INVALID_RESPONSE_FORMAT_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2122, "MISSING_RESPONSE_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2123, "MISSING_STATUS_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2124, "MISSING_STATUS_CODE_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2125, "SESSION_FOUND_WHILE_SUBMITTING_RESET_PASSWORD_PAGE": -2126, "MISSING_DATA_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2127, "MISSING_PUBLIC_KEY_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2128, "MISSING_TX_UUID_WHILE_GET_PUBLIC_KEY_RESET_PASSWORD": -2129, "UNABLE_TO_ENCRYPT_KEY_WHILE_ENCRYPTING_KEY_RESET_PASSWORD": -2130, "EMPTY_ENCRYPTED_KEY_WHILE_ENCRYPTING_KEY_RESET_PASSWORD": -2131, "MISSING_RESPONSE_WHILE_RESET_PASSWORD": -2132, "MISSING_STATUS_WHILE_RESET_PASSWORD": -2133, "MISSING_STATUS_CODE_WHILE_RESET_PASSWORD": -2134, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_RESET_PASSWORD": -2135, "INVALID_RESPONSE_FORMAT_WHILE_RESET_PASSWORD": -2136, "MISSING_NEW_PASSWORD_WHILE_SUBMIT_RESET_PASSWORD": -2158, "PASSWORD_DOES_NOT_CONFORM_TO_IM8_WHILE_SUBMIT_RESET_PASSWORD": -2163, "PASSWORD_TOO_COMMON_WHILE_SUBMIT_RESET_PASSWORD": -2165, "MISSING_RESPONSE_WHILE_UPDATE_PASSWORD": -2212, "MISSING_STATUS_WHILE_UPDATE_PASSWORD": -2213, "MISSING_STATUS_CODE_WHILE_UPDATE_PASSWORD": -2214, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_UPDATE_PASSWORD": -2215, "INVALID_RESPONSE_FORMAT_WHILE_UPDATE_PASSWORD": -2216, "MISSING_ENCRYPTED_CURRENT_PASSWORD_WHILE_SUBMIT_UPDATE_PASSWORD": -2223, "MISSING_ENCRYPTED_NEW_PASSWORD_WHILE_SUBMIT_UPDATE_PASSWORD": -2224, "INCORRECT_CURRENT_PASSWORD_WHILE_UPDATE_PASSWORD": -2340, "PASSWORD_TOO_COMMON_WHILE_SUBMIT_UPDATE_PASSWORD": -2345, "PASSWORD_DOES_NOT_CONFORM_TO_IM8_WHILE_SUBMIT_UPDATE_PASSWORD": -2346, "MISSING_UEN_WHILE_LOGIN": -6006, "MISSING_NRIC_FIN_WHILE_LOGIN": -6007, "MISSING_RESPONSE_WHILE_INIT_CORPPASS_TEST_LOGIN": -6069, "MISSING_STATUS_WHILE_INIT_CORPPASS_TEST_LOGIN": -6070, "MISSING_STATUS_CODE_WHILE_INIT_CORPPASS_TEST_LOGIN": -6071, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_INIT_CORPPASS_TEST_LOGIN": -6072, "INVALID_RESPONSE_FORMAT_WHILE_INIT_CORPPASS_TEST_LOGIN": -6073, "MISSING_DATA_WHILE_INIT_CORPPASS_TEST_LOGIN": -6074, "MISSING_REDIRECT_URL_WHILE_INIT_CORPPASS_TEST_LOGIN": -6075, "INVALID_ERROR_STATUS_WHILE_INIT_CORPPASS_TEST_LOGIN": -6076, "UNKNOWN_ERROR_WHILE_INIT_CORPPASS_TEST_LOGIN": -6077, "EMPTY_UEN_AND_NRIC_FIN_WHILE_LOGIN": -6078, "EMPTY_UEN_WHILE_LOGIN": -6079, "EMPTY_UEN_AND_INVALID_NRIC_FIN_WHILE_LOGIN": -6080, "EMPTY_NRIC_FIN_WHILE_LOGIN": -6081, "INVALID_UEN_AND_EMPTY_NRIC_FIN_WHILE_LOGIN": -6082, "INVALID_UEN_AND_INVALID_NRIC_FIN_WHILE_LOGIN": -6083, "INVALID_NRIC_FIN_WHILE_LOGIN": -6084, "INVALID_UEN_WHILE_LOGIN": -6085, "MISSING_RESPONSE_WHILE_INIT_SINGPASS_TEST_LOGIN": -6090, "MISSING_STATUS_WHILE_INIT_SINGPASS_TEST_LOGIN": -6091, "MISSING_STATUS_CODE_WHILE_INIT_SINGPASS_TEST_LOGIN": -6092, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_INIT_SINGPASS_TEST_LOGIN": -6093, "INVALID_RESPONSE_FORMAT_WHILE_INIT_SINGPASS_TEST_LOGIN": -6094, "MISSING_DATA_WHILE_INIT_SINGPASS_TEST_LOGIN": -6095, "MISSING_REDIRECT_URL_WHILE_INIT_SINGPASS_TEST_LOGIN": -6096, "INVALID_ERROR_STATUS_WHILE_INIT_SINGPASS_TEST_LOGIN": -6097, "UNKNOWN_ERROR_WHILE_INIT_SINGPASS_TEST_LOGIN": -6098, "MISSING_RESPONSE_WHILE_RETRIEVE_ERROR_PAGE_RESOURCES": -6373, "MISSING_STATUS_WHILE_RETRIEVE_ERROR_PAGE_RESOURCES": -6374, "MISSING_STATUS_CODE_WHILE_RETRIEVE_ERROR_PAGE_RESOURCES": -6375, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_RETRIEVE_ERROR_PAGE_RESOURCES": -6376, "INVALID_RESPONSE_FORMAT_WHILE_RETRIEVE_ERROR_PAGE_RESOURCES": -6377, "SESSION_FOUND_WHILE_RESEND_ACTIVATION": -6649, "MISSING_GOOGLE_CAPTCHA_RESPONSE_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6656, "INVALID_CAPTCHA_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6657, "MISSING_USER_EMAIL_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6658, "USER_NOT_FOUND_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6661, "ACTIVE_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6663, "BLOCKED_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6664, "DISABLED_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6665, "LOCKED_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6666, "MISSING_RESPONSE_WHILE_RESEND_ACTIVATION": -6681, "MISSING_STATUS_WHILE_RESEND_ACTIVATION": -6682, "MISSING_STATUS_CODE_WHILE_RESEND_ACTIVATION": -6683, "INVALID_RESPONSE_FORMAT_WITH_STATUS_WHILE_RESEND_ACTIVATION": -6684, "INVALID_RESPONSE_FORMAT_WHILE_RESEND_ACTIVATION": -6685, "INVALID_ERROR_STATUS_WHILE_RESEND_ACTIVATION": -6686, "UNKNOWN_ERROR_WHILE_RESEND_EMAIL_FOR_ACTIVATION": -6687, "UNKNOWN_STATUS_CODE_WHILE_RESEND_ACTIVATION": -6688, "ACTIVE_CORPPASS_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6691, "ACTIVE_SINGPASS_USER_WHILE_RESEND_ACTIVATION_WITHOUT_LOGIN": -6692 }; } } })(); </script> <script> var COMMON_JS = (function() { function preventDefaultAction(evt) { try { if(!evt) { return; } evt.preventDefault(); } catch(e) { console.log("preventDefaultAction() => e =", e); } } function trimString(str) { try { if(isEmptyString(str)) { return str; } return str.trim(); } catch(e) { console.log("trimString() => e =", e); } return str; } function isDisabled(elementId) { try { var ele = document.getElementById(elementId); if(!ele) { return false; } return ele.disabled === true; } catch(e) { console.log("isDisabled() => e =", e); } return false; } function enableElement(elementId) { try { var ele = document.getElementById(elementId); if(!ele) { return false; } ele.disabled = false; return true; } catch(e) { console.log("enableElement() => e =", e); } return false; } function disableElement(elementId) { try { var ele = document.getElementById(elementId); if(!ele) { return false; } ele.disabled = true; return true; } catch(e) { console.log("disableElement() => e =", e); } return false; } function isEnterKeyFromEvent(evt) { try { return evt && (evt.which === ENTER_KEY_IDENTIFIER); } catch(e){ console.log("isEnterKeyFromEvent() => e =", e); } return false; } function getStringValueFromInput(elementId) { try { var ele = document.getElementById(elementId); if(!ele) { return ""; } var eleValue = ele.value; if(typeof(eleValue) !== "string" || eleValue.length <= 0) { return ""; } return eleValue; } catch(e) { console.log("getStringValueFromInput() => e =", e); } return ""; } function getCurrentUrlQueryParam(key) { try { if(typeof(key) !== "string" || key.length <= 0) { return ""; } var currentUrl = window.location.href; var uriObj = URI(currentUrl); var queryMap = uriObj.query(true); if(!queryMap) { return ""; } var queryVal = queryMap[key]; if(typeof(queryVal) === "string") { return queryVal; } else if(Array.isArray(queryVal) && queryVal.length > 0) { return findFirstString(queryVal); } else { return ""; } } catch(e) { console.log("getCurrentUrlQueryParam() => e =", e); } return ""; } function findFirstString(strArr) { if(!Array.isArray(strArr) || strArr.length <= 0) { return ""; } for (var i = 0, sz = strArr.length; i < sz; ++i) { if(typeof(strArr[i]) === "string") { return strArr[i]; } } return ""; } function getCurrentUrl() { try { return window.location.href; } catch(e) { console.log("getCurrentUrl() => e =", e); } return ""; } function isEmptyString(str) { return typeof(str) !== "string" || str.length <= 0; } function getStringErrorObj(code, text) { return { "xhrCode": code, "xhrText": text } } function redirectTo(url) { if(isEmptyString(url)){ return; } if(!window || !window.location){ return; } window.location.href = url; } function sortArray(arr, sortFn) { try { if(!Array.isArray(arr)){ return arr; } if(typeof(sortFn) !== "function"){ return arr; } return arr.sort(sortFn); } catch(e){ console.log("sortArray() => e =", e); } return arr; } // Logo below function appendLogo(logo, parentLogoHolderId, defaultLogoId) { if(isEmptyString(parentLogoHolderId) || isEmptyString(defaultLogoId)) { return; } if(!(logo instanceof $)) { return; } var parentLogoHolder = $("#" + parentLogoHolderId); parentLogoHolder.append(logo); var defaultLogo = $("#" + defaultLogoId); defaultLogo.addClass("hide"); } function generateLogoWithLink(logoUrl, linkUrl) { if(isEmptyString(logoUrl)) { return null; } if(isEmptyString(linkUrl)) { return null; } var logoLink = $("<a>", { "href": linkUrl, "class": "siteLogo" }); var logoHolder = $("<div>", { "class": "siteLogoInfo" }); var logoImg = $("<img>", { "src": logoUrl, "alt": "Logo" }); logoHolder.append(logoImg); logoLink.append(logoHolder); return logoLink; } function generateLogoWithoutLink(logoUrl) { if(isEmptyString(logoUrl)) { return null; } var logoContainer = $("<div>", { "class": "siteLogo" }); var logoHolder = $("<div>", { "class": "siteLogoInfo" }); var logoImg = $("<img>", { "src": logoUrl, "alt": "Logo" }); logoHolder.append(logoImg); logoContainer.append(logoHolder); return logoContainer; } function addLogo(logoUrl, homepageUrl, parentLogoHolderId, defaultLogoId) { var isHomePageUrlEmpty = isEmptyString(homepageUrl); var isLogoUrlEmpty = isEmptyString(logoUrl); if(isLogoUrlEmpty) { return; } var logo = null; if(isHomePageUrlEmpty){ logo = generateLogoWithoutLink(logoUrl); } else { logo = generateLogoWithLink(logoUrl, homepageUrl); } if(!(logo instanceof $)) { return; } appendLogo(logo, parentLogoHolderId, defaultLogoId); } return { "preventDefaultAction": preventDefaultAction, "trimString": trimString, "isDisabled": isDisabled, "enableElement": enableElement, "disableElement": disableElement, "isEnterKeyFromEvent": isEnterKeyFromEvent, "getStringValueFromInput": getStringValueFromInput, "getCurrentUrlQueryParam": getCurrentUrlQueryParam, "findFirstString": findFirstString, "getCurrentUrl": getCurrentUrl, "isEmptyString": isEmptyString, "getStringErrorObj": getStringErrorObj, "redirectTo": redirectTo, "sortArray": sortArray, "addLogo": addLogo } })(); </script> <script type="text/javascript"> (function(GLOBAL_ERROR_CODES, $){ var FORM_ELEMENT_ID = "forgotPasswordForm"; var EMAIL_FIELD_ID = "email"; var SUBMIT_BTN_ID = "submitButton"; var EMAIL_ERROR_ID = "invalidEmailError"; var CAPTCHA_ID = "recaptcha-element"; var ERROR_MESSAGE_ALERT = "errorMessageAlert"; var INVALID_EMAIL_ALERT = "invalidEmailError"; var INVALID_CAPTCHA_ALERT = "captchaError"; var LOGIN_URL = "https://tih-iam.stb.gov.sg/iamsso/login?service=https%3A%2F%2Ftih.stb.gov.sg%2Fbin%2FloginValidation"; var SERVICE_URL = COMMON_JS.getCurrentUrlQueryParam("service"); var EMAIL_NOT_EXIST_MESSAGE = "Please input a valid email."; var EMAIL_REQUIRED_MESSAGE = "Email is required."; var CAPTCHA_REQUIRED_MESSAGE = "Please complete the captcha."; var ACCOUNT_STATUS_REGISTERED_MESSAGE = "Please activate your account via the link sent to your email."; var INVALID_ACCOUNT_STATUS_MESSAGE = "Your account status is invalid. Please contact us at tih_servicedesk@ncs.com.sg or call Tel: (65) 6684 9814."; var INVALID_ACCOUNT_TYPE_MESSAGE = "Only accounts created with portal Id can request for forget password."; if(SERVICE_URL.includes("stan")) { INVALID_ACCOUNT_STATUS_MESSAGE = "Your account status is invalid. Please contact us at stan_servicedesk@ncs.com.sg or call Tel: (65) 6570 3420."; } var REDIRECT_TIMEOUT_MILLISECONDS = 5000; $(document).ready(function() { $("#" + SUBMIT_BTN_ID).click(function(event) { forgetPassword(event); }); }); $("#" + EMAIL_FIELD_ID).change(function() { if(COMMON_JS.isEmptyString($("#" + EMAIL_FIELD_ID).val().trim())) { $("#" + EMAIL_ERROR_ID).show().text(EMAIL_REQUIRED_MESSAGE); checkBasicValidation = true; } else { $("#" + EMAIL_ERROR_ID).text("").hide(); } }); function forgetPassword(event) { COMMON_JS.preventDefaultAction(event); COMMON_JS.disableElement(SUBMIT_BTN_ID); $("#" + ERROR_MESSAGE_ALERT).text("").hide(); $("#" + INVALID_EMAIL_ALERT).text("").hide(); $("#" + INVALID_CAPTCHA_ALERT).text("").hide(); var checkBasicValidation = false; if(COMMON_JS.isEmptyString($("#" + EMAIL_FIELD_ID).val().trim())) { $("#" + EMAIL_ERROR_ID).show().text(EMAIL_REQUIRED_MESSAGE); checkBasicValidation = true; } else { $("#" + EMAIL_ERROR_ID).text("").hide(); } if(checkBasicValidation) { COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); return; } else { var email = COMMON_JS.trimString(COMMON_JS.getStringValueFromInput(EMAIL_FIELD_ID)); initiateForgetPwd(email, SERVICE_URL, function(code, data) { if (code == GLOBAL_ERROR_CODES["SUCCESS"]) { $("#gotoTabLinkId").tab("show"); setTimeout(function(){ COMMON_JS.redirectTo(data.redirectUrl); }, REDIRECT_TIMEOUT_MILLISECONDS); } else if (code == GLOBAL_ERROR_CODES["SESSION_FOUND_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE"]) { COMMON_JS.redirectTo(LOGIN_URL); } else if (code == GLOBAL_ERROR_CODES["MISSING_USER_WHILE_FORGET_PASSWORD"]) { COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_EMAIL_ALERT).show().text(EMAIL_NOT_EXIST_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["INCORRECT_GOOGLE_CAPTCHA"]) { COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_CAPTCHA_ALERT).show().text(CAPTCHA_REQUIRED_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["MISSING_RECAPTCHA_RESPONSE_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE"]){ COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_CAPTCHA_ALERT).show().text(CAPTCHA_REQUIRED_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["MISSING_EMAIL_WHILE_SUBMITTING_FORGET_PASSWORD_PAGE"]){ COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_EMAIL_ALERT).show().text(EMAIL_REQUIRED_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["INVALID_DUE_TO_REGISTERED_ACCOUNT_STATUS"]){ COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_EMAIL_ALERT).show().text(ACCOUNT_STATUS_REGISTERED_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["INVALID_USER_ACCOUNT_STATUS"]) { COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_EMAIL_ALERT).show().html(INVALID_ACCOUNT_STATUS_MESSAGE); } else if (code == GLOBAL_ERROR_CODES["ACCOUNT_TYPE_NOT_PL_WHILE_FORGET_PASSWORD"]){ COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + INVALID_EMAIL_ALERT).show().text(INVALID_ACCOUNT_TYPE_MESSAGE); } else { COMMON_JS.enableElement(SUBMIT_BTN_ID); grecaptcha.reset(); $("#" + ERROR_MESSAGE_ALERT).show().text("Error status code: " + code); } }); } } function initiateForgetPwd(email, service, callbackFn) { if(typeof(callbackFn) !== "function"){ callbackFn = function(){}; } var triggerForgetPwdFn = function() { var input = { "service": service, "email": email, "gRecaptchaResponse": grecaptcha.getResponse() }; $.ajax({ url: "/iamsso/initiateForgetPassword", data: JSON.stringify(input), contentType: 'application/json;charset=utf-8', type: 'POST', dataType: 'json', success: function(data) { console.log("initiateForgetPassword() success => data =", data); if(!data){ callbackFn(GLOBAL_ERROR_CODES["MISSING_RESPONSE_WHILE_FORGET_PASSWORD"]); return; } var status = data["status"]; if(!status){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_WHILE_FORGET_PASSWORD"]); return; } var statusCode = status["statusCode"]; if(typeof(statusCode) !== "number"){ callbackFn(GLOBAL_ERROR_CODES["MISSING_STATUS_CODE_WHILE_FORGET_PASSWORD"]); return; } callbackFn(statusCode, data["data"]); }, error: function(xhr) { console.log("initiateLogin() 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_FORGET_PASSWORD"], COMMON_JS.getStringErrorObj(xhr["status"], xhr["responseText"]) ); } else if(xhr && typeof(xhr["status"]) === "number") { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_FORGET_PASSWORD"], COMMON_JS.getStringErrorObj(xhr["status"], "") ); } else { callbackFn( GLOBAL_ERROR_CODES["INVALID_RESPONSE_FORMAT_WHILE_FORGET_PASSWORD"] ); } } }) } triggerForgetPwdFn(); } })(GLOBAL_ERROR_CODES_FACTORY.generate(), $); </script> </body> </html>