Guest User

Untitled

a guest
Feb 15th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.42 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" id="forgotPasswordContainer">
  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('okta');">
  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" name="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" name="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 hidden>
  232. <input type="text"
  233. class="form-control" id="userId" name="userId"
  234. placeholder="Enter Confirm Password" required>
  235. </div>
  236.  
  237. <div class="row button-section">
  238. <div class="col-md-2"></div>
  239. <div class="col-md-8 pr-0">
  240. <input type="button" class="btn btn-primary" onclick="resetPassword();" value="Submit" style="width: 100%;">
  241. </div>
  242. </div>
  243.  
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248.  
  249. <div class="container col-md-10 col-md-offset-1" id="errorScreen">
  250. <div class="container" style="padding:0px;" >
  251. <div class="row" style="padding-top:40px; padding-bottom:40px;">
  252. <div class="container col-md-10 col-md-offset-1" style="outline: 2px solid #ea4051; box-shadow: -1px 1px 6px;">
  253.  
  254. <p style="font-size: 20px; color: red; margin: 0px;">An Error Occurred. Please contact IHIE. </p>
  255. <p style="font-size: 15px; color: red;">Email: support@ihie.org </p>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260.  
  261. <div class="sub-text">
  262. <p>If you do not remember this information, please contact the IHIE Help Desk at 877-435-7343 or Helpdesk@ihie.org </p>
  263. </div>
  264. </div>
  265. </div>
  266.  
  267. <div>
  268. <p style="background-color: #3a73b1; height: 30px; text-align: left; padding-left: 20px; padding-top: 4px;"></p>
  269. </div>
  270.  
  271. </div>
  272. </div>
  273. </div>
  274. <div class="loader loader-default" id="loadingSpinner"></div>
  275. </body>
  276.  
  277. <script th:inline="javascript">
  278. var contextPath = window.location.href.split('/')[3];
  279.  
  280. document.getElementById('forgotPasswordMain').style.display = 'block';
  281. document.getElementById('vpnScreen').style.display = 'none';
  282. document.getElementById('nonVpnScreen').style.display = 'none';
  283. document.getElementById('pwScreen').style.display = 'none';
  284. document.getElementById('errorScreen').style.display = 'none';
  285.  
  286. var institutes = /*[[${institutionList}]]*/ 'defaultanyvalue';
  287. var error = /*[[${error}]]*/ '';
  288. var userId = /*[[${userId}]]*/ '';
  289. var postForgotResult = {};
  290. var nonVpnData = {};
  291.  
  292. if(error){
  293. document.getElementById('pwScreen').style.display = 'block';
  294. document.getElementById('forgotPasswordMain').style.display = 'none';
  295. document.getElementById('errorDiv').style.display = 'block';
  296. document.getElementById('message').innerHTML = error;
  297. }
  298.  
  299. var cookiePresent = checkCookie("institutionId");
  300.  
  301. if(cookiePresent != ""){
  302. var instId = getCookie("institutionId");
  303. $('#dropOperator').find("option[value*='instId']").prop('selected', true);
  304. document.getElementById('dropOperator').value = instId;
  305. }
  306.  
  307. function forgotPwSubmit() {
  308. $('#loadingSpinner').addClass('is-active');
  309. var selectedInstituteId = document.getElementById('dropOperator').value;
  310. var finalData;
  311.  
  312. finalData = getInstitution(selectedInstituteId);
  313.  
  314. if(cookiePresent != ""){
  315. getInstitution(selectedInstituteId);
  316. setCookie("institutionId", selectedInstituteId, 30);
  317. setCookie("institutionName", finalData['institutionName'], 30);
  318. }
  319. else if(cookiePresent == ""){
  320.  
  321. setCookie("institutionId", selectedInstituteId, 30);
  322. setCookie("institutionName", finalData['institutionName'], 30);
  323. }
  324.  
  325.  
  326. if (username != '' && selectedInstituteId != '') {
  327. document.getElementById('errorDiv').style.display = 'none';
  328. document.getElementById('mainSubmit').disabled = true;
  329. document.getElementById('dropOperatorSpan').style.display = 'none';
  330. document.getElementById('usernameSpan').style.display = 'none';
  331.  
  332. $.ajax({
  333. method: "POST",
  334. url: '/' + contextPath + '/password/forgot',
  335. data: JSON.stringify(finalData),
  336. contentType: "application/json; charset=utf-8",
  337. success: function(data){
  338. postForgotResult = data;
  339. console.log("Data in Ajax is: ", data);
  340. if(data.connectionType == 'VPN') {
  341. document.getElementById('forgotPasswordMain').style.display = 'none';
  342. document.getElementById('vpnScreen').style.display = 'block';
  343. document.getElementById('nonVpnScreen').style.display = 'none';
  344. document.getElementById('pwScreen').style.display = 'none';
  345. document.getElementById('errorScreen').style.display = 'none';
  346.  
  347. document.getElementById('qstn').value = data.recoveryQuestion;
  348. $('#loadingSpinner').removeClass('is-active');
  349. } else if(data.connectionType == 'NONVPN') {
  350. document.getElementById('forgotPasswordMain').style.display = 'none';
  351. document.getElementById('vpnScreen').style.display = 'none';
  352. document.getElementById('nonVpnScreen').style.display = 'block';
  353. document.getElementById('pwScreen').style.display = 'none';
  354. document.getElementById('errorScreen').style.display = 'none';
  355. nonVpnData = data;
  356.  
  357. if (data.factorType == 'sms'){
  358. document.getElementById('sms').style.display = 'block';
  359. }else if (data.factorType == 'email'){
  360. document.getElementById('email').style.display = 'block';
  361. }else if (data.factorType == 'push'){
  362. document.getElementById('push').style.display = 'block';
  363. }
  364. else if (data.factorType == 'OKTA'){
  365. document.getElementById('okta').style.display = 'block';
  366. }
  367. $('#loadingSpinner').removeClass('is-active');
  368. } else {
  369. document.getElementById('forgotPasswordMain').style.display = 'none';
  370. document.getElementById('vpnScreen').style.display = 'none';
  371. document.getElementById('nonVpnScreen').style.display = 'none';
  372. document.getElementById('pwScreen').style.display = 'none';
  373. document.getElementById('errorScreen').style.display = 'block';
  374. $('#loadingSpinner').removeClass('is-active');
  375. }
  376. }
  377. });
  378. } else {
  379. if (selectedInstituteId == '' && username !== '') {
  380. document.getElementById('message').innerHTML = 'Please select institution before submitting information.';
  381. document.getElementById('errorDiv').style.display = 'block';
  382. document.getElementById('dropOperatorSpan').style.display = 'block';
  383. document.getElementById('usernameSpan').style.display = 'none';
  384. $('#loadingSpinner').removeClass('is-active');
  385. } else if (username == '' && selectedInstituteId !== ''){
  386. document.getElementById('message').innerHTML = 'Please enter your username before submitting information.';
  387. document.getElementById('errorDiv').style.display = 'block';
  388. document.getElementById('usernameSpan').style.display = 'block';
  389. document.getElementById('dropOperatorSpan').style.display = 'none';
  390. $('#loadingSpinner').removeClass('is-active');
  391. } else {
  392. document.getElementById('message').innerHTML = 'Please select institution before submitting information. Please enter your username before submitting information.';
  393. document.getElementById('errorDiv').style.display = 'block';
  394. document.getElementById('usernameSpan').style.display = 'block';
  395. document.getElementById('dropOperatorSpan').style.display = 'block';
  396. $('#loadingSpinner').removeClass('is-active');
  397. }
  398. }
  399. }
  400.  
  401. function verifyAnswer(){
  402. $('#loadingSpinner').addClass('is-active');
  403. var enteredAnswer = document.getElementById('answer').value;
  404. postForgotResult['answer'] = enteredAnswer;
  405.  
  406. if (enteredAnswer != ''){
  407. document.getElementById('errorDiv').style.display = 'none';
  408. document.getElementById('answerSpan').style.display = 'none';
  409. $.ajax({
  410. method: "POST",
  411. url: '/' + contextPath + '/password/answer',
  412. data: JSON.stringify(postForgotResult),
  413. contentType: "application/json; charset=utf-8",
  414. success: function(data){
  415. if (data == true){
  416. document.getElementById('forgotPasswordMain').style.display = 'none';
  417. document.getElementById('vpnScreen').style.display = 'none';
  418. document.getElementById('nonVpnScreen').style.display = 'none';
  419. document.getElementById('pwScreen').style.display = 'block';
  420. document.getElementById('errorScreen').style.display = 'none';
  421. document.getElementById('errorDiv').style.display = 'none';
  422. document.getElementById('answerSpan').style.display = 'none';
  423. $('#loadingSpinner').removeClass('is-active');
  424. } else {
  425. document.getElementById('message').innerHTML = 'The answer you provided is incorrect. Please re-enter your answer.';
  426. document.getElementById('errorDiv').style.display = 'block';
  427. document.getElementById('answerSpan').style.display = 'block';
  428. $('#loadingSpinner').removeClass('is-active');
  429. }
  430. }
  431. });
  432. } else {
  433. document.getElementById('message').innerHTML = 'Please enter the answer to your security question before submitting information.';
  434. document.getElementById('errorDiv').style.display = 'block';
  435. document.getElementById('answerSpan').style.display = 'block';
  436. $('#loadingSpinner').removeClass('is-active');
  437. }
  438. }
  439.  
  440. function resetPassword() {
  441. $('#loadingSpinner').addClass('is-active');
  442. var enteredPassword = document.getElementById('password').value;
  443. var enteredConfirmPassword = document.getElementById('confirmPassword').value;
  444. var form = document.getElementById('myForm');
  445.  
  446. if (enteredPassword != '' && enteredConfirmPassword != '') {
  447. document.getElementById('errorDiv').style.display = 'none';
  448. document.getElementById('passwordSpan').style.display = 'none';
  449. document.getElementById('confirmPasswordSpan').style.display = 'none';
  450.  
  451. if(enteredPassword == enteredConfirmPassword) {
  452. postForgotResult['password'] = enteredPassword;
  453. if(error && userId){
  454. document.getElementById('userId').value = userId;
  455. }else{
  456. document.getElementById('userId').value = postForgotResult['userId'];
  457. }
  458.  
  459. form.submit();
  460.  
  461. <!--$.ajax({-->
  462. <!--method: "POST",-->
  463. <!--url: '/' + contextPath + '/password/change',-->
  464. <!--data: JSON.stringify(postForgotResult),-->
  465. <!--contentType: "application/json; charset=utf-8",-->
  466. <!--success: function(data){-->
  467. <!--&lt;!&ndash;if (data == null) {&ndash;&gt;-->
  468. <!--&lt;!&ndash;var curUrl = window.location.href;&ndash;&gt;-->
  469. <!--&lt;!&ndash;var pathList = curUrl.split("/");&ndash;&gt;-->
  470. <!--&lt;!&ndash;var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;&ndash;&gt;-->
  471. <!--&lt;!&ndash;window.location.href = signinPath;&ndash;&gt;-->
  472. <!--&lt;!&ndash;}&ndash;&gt;-->
  473. <!--if(data){-->
  474. <!--document.getElementById('forgotPasswordContainer').style.display = 'none';-->
  475. <!--document.write(data);-->
  476. <!--$('#loadingSpinner').removeClass('is-active');-->
  477. <!--}-->
  478. <!--}-->
  479. <!--});-->
  480. } else {
  481. document.getElementById('message').innerHTML = 'The passwords do not match. Please re-enter';
  482. document.getElementById('errorDiv').style.display = 'block';
  483. $('#loadingSpinner').removeClass('is-active');
  484. }
  485. } else {
  486. if (enteredPassword == '' && enteredConfirmPassword !== ''){
  487. document.getElementById('message').innerHTML = 'Please enter the password before submitting information.';
  488. document.getElementById('errorDiv').style.display = 'block';
  489. document.getElementById('passwordSpan').style.display = 'block';
  490. document.getElementById('confirmPasswordSpan').style.display = 'none';
  491. $('#loadingSpinner').removeClass('is-active');
  492. } else if (enteredPassword !== '' && enteredConfirmPassword == ''){
  493. document.getElementById('message').innerHTML = 'Please enter the confirmation password before submitting information.';
  494. document.getElementById('errorDiv').style.display = 'block';
  495. document.getElementById('passwordSpan').style.display = 'none';
  496. document.getElementById('confirmPasswordSpan').style.display = 'block';
  497. $('#loadingSpinner').removeClass('is-active');
  498. } else {
  499. document.getElementById('message').innerHTML = 'Please enter the password and confirmation password before submitting information.';
  500. document.getElementById('errorDiv').style.display = 'block';
  501. document.getElementById('passwordSpan').style.display = 'block';
  502. document.getElementById('confirmPasswordSpan').style.display = 'block';
  503. $('#loadingSpinner').removeClass('is-active');
  504. }
  505. }
  506. }
  507.  
  508. function sendCode(factorType){
  509. $('#loadingSpinner').addClass('is-active');
  510. nonVpnData['passCode'] = null;
  511. btnId = '#' + factorType + 'Btn';
  512. var btnText = $(btnId)[0].getAttribute("value");
  513. var type;
  514. if (btnText == 'Send Code'){
  515. type = 'send';
  516. }else {
  517. type='resend';
  518. }
  519. $(btnId).attr("disabled", "disabled");
  520. if (factorType == 'push') {
  521. document.getElementById('pushBtn').disabled = true;
  522. console.log("Inside first Condition");
  523. $.ajax({
  524. method: "POST",
  525. url: '/' + contextPath + '/password/send',
  526. data: JSON.stringify(nonVpnData),
  527. contentType: "application/json; charset=utf-8",
  528. success: function(data){
  529. console.log("Inside first AJAX");
  530. var timer = setInterval(function(){
  531. $.ajax({
  532. method: "POST",
  533. url: '/' + contextPath + '/password/poll',
  534. data: JSON.stringify(data),
  535. contentType: "application/json; charset=utf-8",
  536. success: function(pollData){
  537. console.log("Inside second Condition", pollData);
  538. if ('factorResult' in pollData && pollData.factorResult == 'REJECTED'){
  539. clearInterval(timer);
  540. var curUrl = window.location.href;
  541. var pathList = curUrl.split("/");
  542. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  543. window.location.href = signinPath;
  544. }else if ('factorResult' in pollData && pollData.factorResult == 'SUCCESS') {
  545. clearInterval(timer);
  546. document.getElementById('forgotPasswordMain').style.display = 'none';
  547. document.getElementById('vpnScreen').style.display = 'none';
  548. document.getElementById('nonVpnScreen').style.display = 'none';
  549. document.getElementById('pwScreen').style.display = 'block';
  550. document.getElementById('errorScreen').style.display = 'none';
  551. $('#loadingSpinner').removeClass('is-active');
  552. }else if ('factorResult' in pollData && pollData.factorResult == 'TIMEOUT'){
  553. clearInterval(timer);
  554. var curUrl = window.location.href;
  555. var pathList = curUrl.split("/");
  556. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  557. window.location.href = signinPath;
  558. }
  559. }
  560. });
  561. }, 3000);
  562. }
  563. });
  564. } else {
  565. $.ajax({
  566. method: "POST",
  567. url: '/' + contextPath + '/password/send',
  568. data: JSON.stringify(nonVpnData),
  569. contentType: "application/json; charset=utf-8",
  570. success: function(data){
  571. console.log("Inside else ajax", factorType);
  572. if ('factorResult' in data){
  573. $('#loadingSpinner').removeClass('is-active');
  574. } else {
  575. var curUrl = window.location.href;
  576. var pathList = curUrl.split("/");
  577. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  578. window.location.href = signinPath;
  579. }
  580. }
  581. });
  582. setTimeout(function(){
  583. $(btnId).attr("value", "Re-send Code");
  584. $(btnId).removeAttr("disabled");
  585. }, 30000);
  586. }
  587. $(btnId).attr("value", "Sent");
  588. }
  589.  
  590. function verifyPasscode(type){
  591. $('#loadingSpinner').addClass('is-active');
  592. var passCode;
  593. if(type == 'sms'){
  594. passCode = document.getElementById('smsPasscode').value;
  595. } else if (type == 'email'){
  596. passCode = document.getElementById('emailPasscode').value;
  597. }else if (type == 'okta'){
  598. passCode = document.getElementById('oktaPasscode').value;
  599. }
  600. if (passCode != ''){
  601. nonVpnData['passCode'] = passCode;
  602. console.log("nonVPNData is: ", nonVpnData);
  603. $.ajax({
  604. method: "POST",
  605. url: '/' + contextPath + '/password/verify',
  606. data: JSON.stringify(nonVpnData),
  607. contentType: "application/json; charset=utf-8",
  608. success: function(data){
  609. if ('factorResult' in data){
  610. if(data.factorResult == 'SUCCESS'){
  611. $('#loadingSpinner').removeClass('is-active');
  612. document.getElementById('forgotPasswordMain').style.display = 'none';
  613. document.getElementById('vpnScreen').style.display = 'none';
  614. document.getElementById('nonVpnScreen').style.display = 'none';
  615. document.getElementById('pwScreen').style.display = 'block';
  616. document.getElementById('errorScreen').style.display = 'none';
  617. } else {
  618. var curUrl = window.location.href;
  619. var pathList = curUrl.split("/");
  620. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  621. window.location.href = signinPath;
  622. }
  623. }else if('error' in data){
  624. $('#loadingSpinner').removeClass('is-active');
  625. document.getElementById('errorDiv').style.display = 'block';
  626. document.getElementById('message').innerHTML = data.error;
  627.  
  628. }
  629. else {
  630. var curUrl = window.location.href;
  631. var pathList = curUrl.split("/");
  632. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  633. window.location.href = signinPath;
  634. }
  635. }
  636. });
  637. }
  638. }
  639.  
  640. function verifyPushPasscode() {
  641. $('#loadingSpinner').addClass('is-active');
  642. passCode = document.getElementById('pushPasscode').value;
  643. if (passCode != ''){
  644. nonVpnData['passCode'] = passCode;
  645. $.ajax({
  646. method: "POST",
  647. url: '/' + contextPath + '/password/verify',
  648. data: JSON.stringify(nonVpnData),
  649. contentType: "application/json; charset=utf-8",
  650. success: function(data){
  651. if ('factorResult' in data){
  652. if(data.factorResult == 'SUCCESS'){
  653. $('#loadingSpinner').removeClass('is-active');
  654. alert('SUCCESS');
  655. } else {
  656. $('#loadingSpinner').removeClass('is-active');
  657. alert(data.factorResult);
  658. }
  659. } else {
  660. var curUrl = window.location.href;
  661. var pathList = curUrl.split("/");
  662. var signinPath = pathList[0] + "//" + pathList[2] + "/" + contextPath + "/signin" ;
  663. window.location.href = signinPath;
  664. }
  665. }
  666. });
  667. }
  668. }
  669.  
  670. function setCookie(cname,cvalue,exdays) {
  671. var d = new Date();
  672. d.setTime(d.getTime() + (exdays*24*60*60*1000));
  673. var expires = "expires=" + d.toGMTString();
  674. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  675. }
  676.  
  677. function getCookie(cname) {
  678. var name = cname + "=";
  679. var decodedCookie = decodeURIComponent(document.cookie);
  680. var ca = decodedCookie.split(';');
  681. for(var i = 0; i < ca.length; i++) {
  682. var c = ca[i];
  683. while (c.charAt(0) == ' ') {
  684. c = c.substring(1);
  685. }
  686. if (c.indexOf(name) == 0) {
  687. return c.substring(name.length, c.length);
  688. }
  689. }
  690. return "";
  691. }
  692.  
  693. function checkCookie(instName) {
  694. var user=getCookie(instName);
  695. if (user != "") {
  696. console.log("The cookie is: ", user);
  697. return user;
  698.  
  699. <!--document.getElementById('institution').style.display = 'none';-->
  700. <!--document.getElementById('institution').value = user;-->
  701. }
  702. else{
  703. return "";
  704. }
  705. <!--else if(document.getElementById('dropOperator').options[document.getElementById('dropOperator').selectedIndex].text != ""){-->
  706. <!--user = document.getElementById('dropOperator').options[document.getElementById('dropOperator').selectedIndex].text;-->
  707.  
  708. <!--alert(user);-->
  709.  
  710. <!--if (user != "" && user != null) {-->
  711. <!--setCookie(institutionName, user, 30);-->
  712. <!--}-->
  713. <!--}-->
  714. }
  715.  
  716. function getInstitution(selectedIns){
  717. let data = {};
  718. for(var i=0; i<institutes.length; i++){
  719. if (institutes[i].institutionId == selectedIns){
  720. data = institutes[i];
  721. }
  722. }
  723.  
  724. var username = document.getElementById('username').value;
  725. data['username'] = username;
  726. return data;
  727. }
  728. </script>
  729. </html>
Add Comment
Please, Sign In to add comment