Guest User

Untitled

a guest
Feb 14th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.60 KB | None | 0 0
  1. <html xmlns:th="http://www.thymeleaf.org">
  2.  
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  6. <title>Forgot Password</title>
  7. <link rel="stylesheet" href="resource/bootstrap.min.css"/>
  8. <link rel="stylesheet" href="resource/forgotPassword.css">
  9. <script src="resource/jquery.min.js"></script>
  10. <script src="resource/bootstrap.min.js"></script>
  11. <link rel="stylesheet" href="resource/css-loader.css">
  12. </head>
  13.  
  14. <body>
  15.  
  16. <div class="content-wrapper">
  17. <div class="panel-body text-center" style=" padding-top:120px;">
  18. <div class="container col-md-6 col-md-offset-3" style=" outline: 2px solid black; padding-left:0px; padding-right:0px;box-shadow: -1px -2px 5px;}">
  19.  
  20. <div class="container" style="outline: 2px solid black;">
  21. <div class="row">
  22. <div>
  23. <img style="width: 500px;" th:src="@{/logo/IHIELogo}" alt="IHIE Logo">
  24. </div>
  25.  
  26. <div style="width:98%;">
  27. <div>
  28. <p class="zero-margin" style="text-align: right;"><img style="padding-bottom: 3px; width: 150px;" th:src="@{/logo/careWebLogo}"></p>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33.  
  34.  
  35. <div class="container" style="padding:0px;" >
  36. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  37. <div class="alert-wrap">
  38. <div class="alert" id="errorDiv" style="display: none;">
  39. <div class="icon-section"><img th:src="@{/logo/warning}" width="25px" height="25px"></div>
  40. <div class="alert-msg"><p id="message" ></p></div>
  41. </div>
  42. </div>
  43. <div class="container col-md-10 col-md-offset-1" id="forgotPasswordMain">
  44.  
  45. <h4 class="page-header">
  46. Reset Password
  47. </h4>
  48.  
  49. <div class="form-group row no-gutters" id = "institution">
  50. <label for="dropOperator" class="col-sm-4 col-md-4 form-control-label text-right" style="padding-top: 7px; font-weight: bold; padding-right: 7px;">Institution<span style="color: #e25c5c;">*</span></label>
  51. <div class="col-sm-6 col-md-6" style="padding:0px;">
  52. <select class="form-control" th:field="${institutionList}" id="dropOperator" th:name="dropOperator" required>
  53. <option value=""><span class="dropdown-text">Use drop-down to select your institution</span></option>
  54. <option th:each="option : ${institutionList}" th:value="${option.institutionId}" th:text="${option.institutionName}"></option>
  55. </select>
  56. </div>
  57. <div class="icon-section warning" id="dropOperatorSpan" style="display: none;"><img style="margin-top: 3px;" th:src="@{/logo/warning}" width="25px" height="25px"></div>
  58. </div>
  59.  
  60. <div class="form-group row no-gutters">
  61. <label for="username" class="col-sm-4 col-md-4 form-control-label text-right" style="padding-top: 7px; font-weight: bold; padding-right: 7px;">Username<span style="color: #e25c5c;">*</span></label>
  62. <div class="col-sm-6 col-md-6" style="padding:0px;">
  63. <input type="text"
  64. class="form-control" id="username"
  65. placeholder="Enter your current username" required>
  66. </div>
  67. <div class="icon-section warning" id="usernameSpan" style="display: none;"><img style="margin-top: 3px;" th:src="@{/logo/warning}" width="25px" height="25px"></div>
  68. </div>
  69.  
  70. <div class="row button-section">
  71. <div class="col-md-2"></div>
  72. <div class="col-md-8 pr-0">
  73. <input type="button" class="btn btn-primary" onclick="forgotPwSubmit();" id="mainSubmit" value="Submit" style="width: 100%;">
  74. </div>
  75. </div>
  76.  
  77. </div>
  78.  
  79. <div class="container col-md-10 col-md-offset-1" id="vpnScreen">
  80. <div class="container" style="padding:0px;" >
  81. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  82. <div class="container col-md-10 col-md-offset-1">
  83.  
  84. <h4 class="page-header">
  85. Verify Your Identity
  86. </h4>
  87.  
  88. <!--<div style="float: left;">-->
  89. <!--&lt;!&ndash;<textarea id="qstn">Question Goes here.......?</textarea>&ndash;&gt;-->
  90. <!--<span id="qstn" class="security-qstn">Question Goes here.......?</span>-->
  91. <!--</div>-->
  92.  
  93. <!--<div class="col-md-12 m0 p-0 float-left">-->
  94. <!--<div class="col-md-6 p-0 mb-4" style="padding: 15px;">-->
  95. <!--<input type="password" class="form-control" placeholder="Enter the answer">-->
  96. <!--</div>-->
  97. <!--</div>-->
  98. <div style="padding-bottom: 10px;">
  99. <label style="float: left;">Please answer your security question:</label>
  100. <input type="text" class="form-control pb-10" id="qstn" readonly>
  101. </div>
  102.  
  103. <div style="padding-bottom: 10px;">
  104. <label style="float: left;">Answer:</label>
  105. <div class="d-flex col-md-12 pl-0 pr-2">
  106. <input type="text" class="form-control" id="answer" placeholder="please enter your answer">
  107. <div class="icon-section warning" id="answerSpan" style="display: none;"><img style="margin-top: 3px;" th:src="@{/logo/warning}" width="25px" height="25px"></div>
  108. </div>
  109. </div>
  110.  
  111. <div class="row button-section">
  112. <input type="button" class="btn btn-primary" value="Verify" style="width: 100%;" onclick="verifyAnswer();">
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118.  
  119. <div class="container col-md-10 col-md-offset-1" id="nonVpnScreen">
  120. <div class="container" style="padding:0px;" >
  121. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  122. <div class="container col-md-10 col-md-offset-1">
  123.  
  124. <div class="row">
  125. <div class="col-md-12" id="email" style="display: none;">
  126. <h4 class="page-header text-center">
  127. Email Verification
  128. </h4>
  129. <!--<div>(d....i@tecnics.com)</div>-->
  130. <div class="row col-md-12" style="padding: 0; margin: 20px 0px;">
  131. <div class="col-md-4 zero-margin button-section" style=" padding-left: 0px; width: 100%; margin: 0;">
  132. <input class="btn btn-primary" type="button" id="emailBtn" onclick="sendCode('email');" value="Send Code">
  133. </div>
  134. <div class="col-md-8 zero-margin enter-passcode" style="padding-right: 0px;">
  135. <input class="form-control" type="text" id="emailPasscode" placeholder="Enter Passcode">
  136. </div>
  137. </div>
  138. <div class="col-md-12 row button-section">
  139. <input class="btn btn-primary" style="width:100%;" type="button" id="emailSubmitBtn" value="Verify" onclick="verifyPasscode('email');">
  140. </div>
  141. </div>
  142.  
  143. <div class="col-md-12" id="sms" style="display: none;">
  144. <h4 class="page-header text-center">
  145. SMS Verification
  146. </h4>
  147. <div class="row col-md-12" style="padding: 0; margin: 20px 0px;">
  148. <div class="col-md-4 zero-margin button-section" style="padding-left: 0px; width: 100%; margin: 0;">
  149. <input class="btn btn-primary" type="button" id="smsBtn" onclick="sendCode('sms');" value="Send Code">
  150. </div>
  151. <div class="col-md-8 zero-margin enter-passcode" style="padding-right: 0px;">
  152. <input class="form-control" type="text" id="smsPasscode" placeholder="Enter Passcode">
  153. </div>
  154. </div>
  155. <div class="col-md-12 row button-section">
  156. <input class="btn btn-primary" style="width:100%;" type="button" id="smsSubmitBtn" value="Verify" onclick="verifyPasscode('sms');">
  157. </div>
  158. </div>
  159.  
  160. <div class="col-md-12" id="okta" style="display: none;">
  161. <h4 class="page-header text-center">
  162. OKTA Verification
  163. </h4>
  164. <div class="row col-md-12" style="padding: 0; margin: 20px 0px;">
  165. <div class="col-md-4 zero-margin button-section" style="padding-left: 0px; width: 100%; margin: 0;">
  166. <label id="oktaLabel">Please enter the code displayed in the OKTA application.</label>
  167. </div>
  168. <div class="col-md-8 zero-margin enter-passcode" style="padding-right: 0px;">
  169. <input class="form-control" type="text" id="oktaPasscode" placeholder="Enter Passcode">
  170. </div>
  171. </div>
  172. <div class="col-md-12 row button-section">
  173. <input class="btn btn-primary" style="width:100%;" type="button" id="oktaSubmitBtn" value="Verify" onclick="verifyPasscode('sms');">
  174. </div>
  175. </div>
  176.  
  177. <div class="col-md-12" id="push" style="display: none;">
  178. <h4 class="page-header text-center" style=" width: 100%;">Okta Push Verification </h4>
  179.  
  180. <div class="row button-section">
  181. <input class="btn btn-primary" type="button" id="pushBtn" value="Send Push" onclick="sendCode('push');">
  182. </div>
  183.  
  184. <!--<div class="text-center" style="width: 100%; padding: 2% 4% 6%;"><a href="#" onclick="diplayCodeBlock();">or enter code</a></div>-->
  185.  
  186. <!--<div id="codeBlock" >-->
  187. <!--<div class="col-md-8 zero-margin" style="padding-left: 0px; float: left;"><input class="form-control" type="text" id="pushPasscode" placeholder="Enter Passcode"></div>-->
  188. <!--<div class="col-md-4 button-section zero-margin" style=" margin: 0; padding: 0; float: left"><input class="btn btn-primary" type="button" id="pushVerify" value="Verify" onclick="verifyPushPasscode();"></div>-->
  189. <!--</div>-->
  190. </div>
  191. </div>
  192.  
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197.  
  198. <div class="container col-md-10 col-md-offset-1" id="pwScreen">
  199. <div class="container" style="padding:0px;" >
  200. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  201. <div class="container col-md-10 col-md-offset-1">
  202.  
  203. <h4 class="page-header">
  204. Reset Password
  205. </h4>
  206.  
  207. <div class="sub-text" style="width: 70%;">
  208. <p style="font-size: 14px;">CareWeb requires a new password every 90 days. Please enter an new password.</p>
  209. </div>
  210.  
  211. <div class="form-group row no-gutters">
  212. <label for="username" class="col-sm-5 col-md-5 form-control-label text-right" style="padding-top: 7px; font-weight: bold; padding-right: 7px;">Password<span style="color: #e25c5c;">*</span></label>
  213. <div class="col-sm-6 col-md-6" style="padding:0px;">
  214. <input type="password"
  215. class="form-control" id="password"
  216. placeholder="Enter Password" required>
  217. </div>
  218. <div class="icon-section warning" id="passwordSpan" style="display: none;"><img style="margin-top: 3px;" th:src="@{/logo/warning}" width="25px" height="25px"></div>
  219. </div>
  220.  
  221. <div class="form-group row no-gutters">
  222. <label for="username" class="col-sm-5 col-md-5 form-control-label text-right" style="padding-top: 7px; font-weight: bold; padding-right: 7px;">Confirm Password<span style="color: #e25c5c;">*</span></label>
  223. <div class="col-sm-6 col-md-6" style="padding:0px;">
  224. <input type="password"
  225. class="form-control" id="confirmPassword"
  226. placeholder="Enter Confirm Password" required>
  227. </div>
  228. <div class="icon-section warning" id="confirmPasswordSpan" style="display: none;"><img style="margin-top: 3px;" th:src="@{/logo/warning}" width="25px" height="25px"></div>
  229. </div>
  230.  
  231. <div class="row button-section">
  232. <div class="col-md-2"></div>
  233. <div class="col-md-8 pr-0">
  234. <input type="button" class="btn btn-primary" onclick="resetPassword();" value="Submit" style="width: 100%;">
  235. </div>
  236. </div>
  237.  
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242.  
  243. <div class="container col-md-10 col-md-offset-1" id="errorScreen">
  244. <div class="container" style="padding:0px;" >
  245. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  246. <div class="container col-md-10 col-md-offset-1" style="outline: 2px solid #ea4051; box-shadow: -1px 1px 6px;">
  247.  
  248. <p style="font-size: 20px; color: red; margin: 0px;">An Error Occurred. Please contact IHIE. </p>
  249. <p style="font-size: 15px; color: red;">Email: support@ihie.org </p>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254.  
  255. <div class="sub-text">
  256. <p>If you do not remember this information, please contact the IHIE Help Desk at 877-435-7343 or Helpdesk@ihie.org </p>
  257. </div>
  258. </div>
  259. </div>
  260.  
  261. <div>
  262. <p style="background-color: #3a73b1; height: 30px; text-align: left; padding-left: 20px; padding-top: 4px;"></p>
  263. </div>
  264.  
  265. </div>
  266. </div>
  267. </div>
  268. <div class="loader loader-default" id="loadingSpinner"></div>
  269. </body>
  270.  
  271. <script th:inline="javascript">
  272. var contextPath = window.location.href.split('/')[3];
  273.  
  274. document.getElementById('forgotPasswordMain').style.display = 'block';
  275. document.getElementById('vpnScreen').style.display = 'none';
  276. document.getElementById('nonVpnScreen').style.display = 'none';
  277. document.getElementById('pwScreen').style.display = 'none';
  278. document.getElementById('errorScreen').style.display = 'none';
  279.  
  280. var institutes = /*[[${institutionList}]]*/ 'defaultanyvalue';
  281. var postForgotResult = {};
  282. var nonVpnData = {};
  283.  
  284. var cookiePresent = checkCookie("institutionId");
  285.  
  286. if(cookiePresent != ""){
  287. var instId = getCookie("institutionId");
  288. $('#dropOperator').find("option[value*='instId']").prop('selected', true);
  289. document.getElementById('dropOperator').value = instId;
  290. }
  291.  
  292. function forgotPwSubmit() {
  293. $('#loadingSpinner').addClass('is-active');
  294. var selectedInstituteId = document.getElementById('dropOperator').value;
  295. var finalData;
  296.  
  297. finalData = getInstitution(selectedInstituteId);
  298.  
  299. if(cookiePresent != ""){
  300. getInstitution(selectedInstituteId);
  301. setCookie("institutionId", selectedInstituteId, 30);
  302. setCookie("institutionName", finalData['institutionName'], 30);
  303. }
  304. else if(cookiePresent == ""){
  305.  
  306. setCookie("institutionId", selectedInstituteId, 30);
  307. setCookie("institutionName", finalData['institutionName'], 30);
  308. }
  309.  
  310.  
  311. if (username != '' && selectedInstituteId != '') {
  312. document.getElementById('errorDiv').style.display = 'none';
  313. document.getElementById('mainSubmit').disabled = true;
  314. document.getElementById('dropOperatorSpan').style.display = 'none';
  315. document.getElementById('usernameSpan').style.display = 'none';
  316.  
  317. $.ajax({
  318. method: "POST",
  319. url: '/' + contextPath + '/password/forgot',
  320. data: JSON.stringify(finalData),
  321. contentType: "application/json; charset=utf-8",
  322. success: function(data){
  323. postForgotResult = data;
  324. console.log("Data in Ajax is: ", data);
  325. if(data.connectionType == 'VPN') {
  326. document.getElementById('forgotPasswordMain').style.display = 'none';
  327. document.getElementById('vpnScreen').style.display = 'block';
  328. document.getElementById('nonVpnScreen').style.display = 'none';
  329. document.getElementById('pwScreen').style.display = 'none';
  330. document.getElementById('errorScreen').style.display = 'none';
  331.  
  332. document.getElementById('qstn').value = data.recoveryQuestion;
  333. $('#loadingSpinner').removeClass('is-active');
  334. } else if(data.connectionType == 'NONVPN') {
  335. document.getElementById('forgotPasswordMain').style.display = 'none';
  336. document.getElementById('vpnScreen').style.display = 'none';
  337. document.getElementById('nonVpnScreen').style.display = 'block';
  338. document.getElementById('pwScreen').style.display = 'none';
  339. document.getElementById('errorScreen').style.display = 'none';
  340. nonVpnData = data;
  341.  
  342. if (data.factorType == 'sms'){
  343. document.getElementById('sms').style.display = 'block';
  344. }else if (data.factorType == 'email'){
  345. document.getElementById('email').style.display = 'block';
  346. }else if (data.factorType == 'push'){
  347. document.getElementById('push').style.display = 'block';
  348. }
  349. else if (data.factorType == 'OKTA'){
  350. document.getElementById('okta').style.display = 'block';
  351. }
  352. $('#loadingSpinner').removeClass('is-active');
  353. } else {
  354. document.getElementById('forgotPasswordMain').style.display = 'none';
  355. document.getElementById('vpnScreen').style.display = 'none';
  356. document.getElementById('nonVpnScreen').style.display = 'none';
  357. document.getElementById('pwScreen').style.display = 'none';
  358. document.getElementById('errorScreen').style.display = 'block';
  359. $('#loadingSpinner').removeClass('is-active');
  360. }
  361. }
  362. });
  363. } else {
  364. if (selectedInstituteId == '' && username !== '') {
  365. document.getElementById('message').innerHTML = 'Please select institution before submitting information.';
  366. document.getElementById('errorDiv').style.display = 'block';
  367. document.getElementById('dropOperatorSpan').style.display = 'block';
  368. document.getElementById('usernameSpan').style.display = 'none';
  369. $('#loadingSpinner').removeClass('is-active');
  370. } else if (username == '' && selectedInstituteId !== ''){
  371. document.getElementById('message').innerHTML = 'Please enter your username before submitting information.';
  372. document.getElementById('errorDiv').style.display = 'block';
  373. document.getElementById('usernameSpan').style.display = 'block';
  374. document.getElementById('dropOperatorSpan').style.display = 'none';
  375. $('#loadingSpinner').removeClass('is-active');
  376. } else {
  377. document.getElementById('message').innerHTML = 'Please select institution before submitting information. Please enter your username before submitting information.';
  378. document.getElementById('errorDiv').style.display = 'block';
  379. document.getElementById('usernameSpan').style.display = 'block';
  380. document.getElementById('dropOperatorSpan').style.display = 'block';
  381. $('#loadingSpinner').removeClass('is-active');
  382. }
  383. }
  384. }
  385.  
  386. function verifyAnswer(){
  387. $('#loadingSpinner').addClass('is-active');
  388. var enteredAnswer = document.getElementById('answer').value;
  389. postForgotResult['answer'] = enteredAnswer;
  390.  
  391. if (enteredAnswer != ''){
  392. document.getElementById('errorDiv').style.display = 'none';
  393. document.getElementById('answerSpan').style.display = 'none';
  394. $.ajax({
  395. method: "POST",
  396. url: '/' + contextPath + '/password/answer',
  397. data: JSON.stringify(postForgotResult),
  398. contentType: "application/json; charset=utf-8",
  399. success: function(data){
  400. if (data == true){
  401. document.getElementById('forgotPasswordMain').style.display = 'none';
  402. document.getElementById('vpnScreen').style.display = 'none';
  403. document.getElementById('nonVpnScreen').style.display = 'none';
  404. document.getElementById('pwScreen').style.display = 'block';
  405. document.getElementById('errorScreen').style.display = 'none';
  406. document.getElementById('errorDiv').style.display = 'none';
  407. document.getElementById('answerSpan').style.display = 'none';
  408. $('#loadingSpinner').removeClass('is-active');
  409. } else {
  410. document.getElementById('message').innerHTML = 'The answer you provided is incorrect. Please re-enter your answer.';
  411. document.getElementById('errorDiv').style.display = 'block';
  412. document.getElementById('answerSpan').style.display = 'block';
  413. $('#loadingSpinner').removeClass('is-active');
  414. }
  415. }
  416. });
  417. } else {
  418. document.getElementById('message').innerHTML = 'Please enter the answer to your security question before submitting information.';
  419. document.getElementById('errorDiv').style.display = 'block';
  420. document.getElementById('answerSpan').style.display = 'block';
  421. $('#loadingSpinner').removeClass('is-active');
  422. }
  423. }
  424.  
  425. function resetPassword() {
  426. $('#loadingSpinner').addClass('is-active');
  427. var enteredPassword = document.getElementById('password').value;
  428. var enteredConfirmPassword = document.getElementById('confirmPassword').value;
  429.  
  430. if (enteredPassword != '' && enteredConfirmPassword != '') {
  431. document.getElementById('errorDiv').style.display = 'none';
  432. document.getElementById('passwordSpan').style.display = 'none';
  433. document.getElementById('confirmPasswordSpan').style.display = 'none';
  434.  
  435. if(enteredPassword == enteredConfirmPassword) {
  436. postForgotResult['password'] = enteredPassword;
  437.  
  438. $.ajax({
  439. method: "POST",
  440. url: '/' + contextPath + '/password/change',
  441. data: JSON.stringify(postForgotResult),
  442. contentType: "application/json; charset=utf-8",
  443. success: function(data){
  444. <!--if (data == null) {-->
  445. <!--var curUrl = window.location.href;-->
  446. <!--var pathList = curUrl.split("/");-->
  447. <!--var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;-->
  448. <!--window.location.href = signinPath;-->
  449. <!--}-->
  450. if(data){
  451. document.write(data);
  452. }
  453. }
  454. });
  455. } else {
  456. document.getElementById('message').innerHTML = 'The passwords do not match. Please re-enter';
  457. document.getElementById('errorDiv').style.display = 'block';
  458. $('#loadingSpinner').removeClass('is-active');
  459. }
  460. } else {
  461. if (enteredPassword == '' && enteredConfirmPassword !== ''){
  462. document.getElementById('message').innerHTML = 'Please enter the password before submitting information.';
  463. document.getElementById('errorDiv').style.display = 'block';
  464. document.getElementById('passwordSpan').style.display = 'block';
  465. document.getElementById('confirmPasswordSpan').style.display = 'none';
  466. $('#loadingSpinner').removeClass('is-active');
  467. } else if (enteredPassword !== '' && enteredConfirmPassword == ''){
  468. document.getElementById('message').innerHTML = 'Please enter the confirmation password before submitting information.';
  469. document.getElementById('errorDiv').style.display = 'block';
  470. document.getElementById('passwordSpan').style.display = 'none';
  471. document.getElementById('confirmPasswordSpan').style.display = 'block';
  472. $('#loadingSpinner').removeClass('is-active');
  473. } else {
  474. document.getElementById('message').innerHTML = 'Please enter the password and confirmation password before submitting information.';
  475. document.getElementById('errorDiv').style.display = 'block';
  476. document.getElementById('passwordSpan').style.display = 'block';
  477. document.getElementById('confirmPasswordSpan').style.display = 'block';
  478. $('#loadingSpinner').removeClass('is-active');
  479. }
  480. }
  481. }
  482.  
  483. function sendCode(factorType){
  484. $('#loadingSpinner').addClass('is-active');
  485. nonVpnData['passCode'] = null;
  486. btnId = '#' + factorType + 'Btn';
  487. var btnText = $(btnId)[0].getAttribute("value");
  488. var type;
  489. if (btnText == 'Send Code'){
  490. type = 'send';
  491. }else {
  492. type='resend';
  493. }
  494. $(btnId).attr("disabled", "disabled");
  495. if (factorType == 'push') {
  496. document.getElementById('pushBtn').disabled = true;
  497. console.log("Inside first Condition");
  498. $.ajax({
  499. method: "POST",
  500. url: '/' + contextPath + '/password/send',
  501. data: JSON.stringify(nonVpnData),
  502. contentType: "application/json; charset=utf-8",
  503. success: function(data){
  504. console.log("Inside first AJAX");
  505. var timer = setInterval(function(){
  506. $.ajax({
  507. method: "POST",
  508. url: '/' + contextPath + '/password/poll',
  509. data: JSON.stringify(data),
  510. contentType: "application/json; charset=utf-8",
  511. success: function(pollData){
  512. console.log("Inside second Condition", pollData);
  513. if ('factorResult' in pollData && pollData.factorResult == 'REJECTED'){
  514. clearInterval(timer);
  515. var curUrl = window.location.href;
  516. var pathList = curUrl.split("/");
  517. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  518. window.location.href = signinPath;
  519. }else if ('factorResult' in pollData && pollData.factorResult == 'SUCCESS') {
  520. clearInterval(timer);
  521. document.getElementById('forgotPasswordMain').style.display = 'none';
  522. document.getElementById('vpnScreen').style.display = 'none';
  523. document.getElementById('nonVpnScreen').style.display = 'none';
  524. document.getElementById('pwScreen').style.display = 'block';
  525. document.getElementById('errorScreen').style.display = 'none';
  526. $('#loadingSpinner').removeClass('is-active');
  527. }else if ('factorResult' in pollData && pollData.factorResult == 'TIMEOUT'){
  528. clearInterval(timer);
  529. var curUrl = window.location.href;
  530. var pathList = curUrl.split("/");
  531. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  532. window.location.href = signinPath;
  533. }
  534. }
  535. });
  536. }, 3000);
  537. }
  538. });
  539. } else {
  540. $.ajax({
  541. method: "POST",
  542. url: '/' + contextPath + '/password/send',
  543. data: JSON.stringify(nonVpnData),
  544. contentType: "application/json; charset=utf-8",
  545. success: function(data){
  546. console.log("Inside else ajax", factorType);
  547. if ('factorResult' in data){
  548. $('#loadingSpinner').removeClass('is-active');
  549. } else {
  550. var curUrl = window.location.href;
  551. var pathList = curUrl.split("/");
  552. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  553. window.location.href = signinPath;
  554. }
  555. }
  556. });
  557. setTimeout(function(){
  558. $(btnId).attr("value", "Re-send Code");
  559. $(btnId).removeAttr("disabled");
  560. }, 30000);
  561. }
  562. $(btnId).attr("value", "Sent");
  563. }
  564.  
  565. function verifyPasscode(type){
  566. $('#loadingSpinner').addClass('is-active');
  567. var passCode;
  568. if(type == 'sms'){
  569. passCode = document.getElementById('smsPasscode').value;
  570. } else if (type == 'email'){
  571. passCode = document.getElementById('emailPasscode').value;
  572. }else if (type == 'okta'){
  573. passCode = document.getElementById('oktaPasscode').value;
  574. }
  575. if (passCode != ''){
  576. nonVpnData['passCode'] = passCode;
  577. console.log("nonVPNData is: ", nonVpnData);
  578. $.ajax({
  579. method: "POST",
  580. url: '/' + contextPath + '/password/verify',
  581. data: JSON.stringify(nonVpnData),
  582. contentType: "application/json; charset=utf-8",
  583. success: function(data){
  584. if ('factorResult' in data){
  585. if(data.factorResult == 'SUCCESS'){
  586. $('#loadingSpinner').removeClass('is-active');
  587. document.getElementById('forgotPasswordMain').style.display = 'none';
  588. document.getElementById('vpnScreen').style.display = 'none';
  589. document.getElementById('nonVpnScreen').style.display = 'none';
  590. document.getElementById('pwScreen').style.display = 'block';
  591. document.getElementById('errorScreen').style.display = 'none';
  592. } else {
  593. var curUrl = window.location.href;
  594. var pathList = curUrl.split("/");
  595. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  596. window.location.href = signinPath;
  597. }
  598. } else {
  599. var curUrl = window.location.href;
  600. var pathList = curUrl.split("/");
  601. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  602. window.location.href = signinPath;
  603. }
  604. }
  605. });
  606. }
  607. }
  608.  
  609. function verifyPushPasscode() {
  610. $('#loadingSpinner').addClass('is-active');
  611. passCode = document.getElementById('pushPasscode').value;
  612. if (passCode != ''){
  613. nonVpnData['passCode'] = passCode;
  614. $.ajax({
  615. method: "POST",
  616. url: '/' + contextPath + '/password/verify',
  617. data: JSON.stringify(nonVpnData),
  618. contentType: "application/json; charset=utf-8",
  619. success: function(data){
  620. if ('factorResult' in data){
  621. if(data.factorResult == 'SUCCESS'){
  622. $('#loadingSpinner').removeClass('is-active');
  623. alert('SUCCESS');
  624. } else {
  625. $('#loadingSpinner').removeClass('is-active');
  626. alert(data.factorResult);
  627. }
  628. } else {
  629. var curUrl = window.location.href;
  630. var pathList = curUrl.split("/");
  631. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  632. window.location.href = signinPath;
  633. }
  634. }
  635. });
  636. }
  637. }
  638.  
  639. function setCookie(cname,cvalue,exdays) {
  640. var d = new Date();
  641. d.setTime(d.getTime() + (exdays*24*60*60*1000));
  642. var expires = "expires=" + d.toGMTString();
  643. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  644. }
  645.  
  646. function getCookie(cname) {
  647. var name = cname + "=";
  648. var decodedCookie = decodeURIComponent(document.cookie);
  649. var ca = decodedCookie.split(';');
  650. for(var i = 0; i < ca.length; i++) {
  651. var c = ca[i];
  652. while (c.charAt(0) == ' ') {
  653. c = c.substring(1);
  654. }
  655. if (c.indexOf(name) == 0) {
  656. return c.substring(name.length, c.length);
  657. }
  658. }
  659. return "";
  660. }
  661.  
  662. function checkCookie(instName) {
  663. var user=getCookie(instName);
  664. if (user != "") {
  665. console.log("The cookie is: ", user);
  666. return user;
  667.  
  668. <!--document.getElementById('institution').style.display = 'none';-->
  669. <!--document.getElementById('institution').value = user;-->
  670. }
  671. else{
  672. return "";
  673. }
  674. <!--else if(document.getElementById('dropOperator').options[document.getElementById('dropOperator').selectedIndex].text != ""){-->
  675. <!--user = document.getElementById('dropOperator').options[document.getElementById('dropOperator').selectedIndex].text;-->
  676.  
  677. <!--alert(user);-->
  678.  
  679. <!--if (user != "" && user != null) {-->
  680. <!--setCookie(institutionName, user, 30);-->
  681. <!--}-->
  682. <!--}-->
  683. }
  684.  
  685. function getInstitution(selectedIns){
  686. let data = {};
  687. for(var i=0; i<institutes.length; i++){
  688. if (institutes[i].institutionId == selectedIns){
  689. data = institutes[i];
  690. }
  691. }
  692.  
  693. var username = document.getElementById('username').value;
  694. data['username'] = username;
  695. return data;
  696. }
  697. </script>
  698. </html>
Add Comment
Please, Sign In to add comment