Guest User

Untitled

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