choose_password 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!DOCTYPE html>
  2. <html>
  3. <!-- This page is displayed when someone clicks a valid 'reset password' link.
  4. Users should feel free to add to this page (i.e. branding or security widgets)
  5. but should be sure not to delete any of the form inputs or the javascript from the
  6. template file. This javascript is what adds the necessary values to authenticate
  7. this session with Parse.
  8. The query params 'username' and 'app' hold the friendly names for your current user and
  9. your app. You should feel free to incorporate their values to make the page more personal.
  10. If you are missing form parameters in your POST, Parse will navigate back to this page and
  11. add an 'error' query parameter.
  12. -->
  13. <head>
  14. <title>Password Reset</title>
  15. <style type='text/css'>
  16. h1 {
  17. display: block;
  18. font: inherit;
  19. font-size: 30px;
  20. font-weight: 600;
  21. height: 30px;
  22. line-height: 30px;
  23. margin: 45px 0px 45px 0px;
  24. padding: 0px 8px 0px 8px;
  25. }
  26. .error {
  27. color: red;
  28. padding: 0px 8px 0px 8px;
  29. margin: -25px 0px -20px 0px;
  30. }
  31. body {
  32. font-family: 'Open Sans', 'Helvetica Neue', Helvetica;
  33. color: #0067AB;
  34. margin: 15px 99px 0px 98px;
  35. }
  36. label {
  37. color: #666666;
  38. }
  39. form {
  40. margin: 0px 0px 45px 0px;
  41. padding: 0px 8px 0px 8px;
  42. }
  43. form > * {
  44. display: block;
  45. margin-top: 25px;
  46. margin-bottom: 7px;
  47. }
  48. button {
  49. font-size: 22px;
  50. color: white;
  51. background: #0067AB;
  52. -moz-border-radius: 5px;
  53. -webkit-border-radius: 5px;
  54. -o-border-radius: 5px;
  55. -ms-border-radius: 5px;
  56. -khtml-border-radius: 5px;
  57. border-radius: 5px;
  58. background-image: -webkit-gradient(linear,50% 0,50% 100%,color-stop(0%,#0070BA),color-stop(100%,#00558C));
  59. background-image: -webkit-linear-gradient(#0070BA,#00558C);
  60. background-image: -moz-linear-gradient(#0070BA,#00558C);
  61. background-image: -o-linear-gradient(#0070BA,#00558C);
  62. background-image: -ms-linear-gradient(#0070BA,#00558C);
  63. background-image: linear-gradient(#0070BA,#00558C);
  64. -moz-box-shadow: inset 0 1px 0 0 #0076c4;
  65. -webkit-box-shadow: inset 0 1px 0 0 #0076c4;
  66. -o-box-shadow: inset 0 1px 0 0 #0076c4;
  67. box-shadow: inset 0 1px 0 0 #0076c4;
  68. border: 1px solid #005E9C;
  69. padding: 10px 14px;
  70. cursor: pointer;
  71. outline: none;
  72. display: block;
  73. font-family: "Helvetica Neue",Helvetica;
  74. -webkit-box-align: center;
  75. text-align: center;
  76. box-sizing: border-box;
  77. letter-spacing: normal;
  78. word-spacing: normal;
  79. line-height: normal;
  80. text-transform: none;
  81. text-indent: 0px;
  82. text-shadow: none;
  83. }
  84. button:hover {
  85. background-image: -webkit-gradient(linear,50% 0,50% 100%,color-stop(0%,#0079CA),color-stop(100%,#005E9C));
  86. background-image: -webkit-linear-gradient(#0079CA,#005E9C);
  87. background-image: -moz-linear-gradient(#0079CA,#005E9C);
  88. background-image: -o-linear-gradient(#0079CA,#005E9C);
  89. background-image: -ms-linear-gradient(#0079CA,#005E9C);
  90. background-image: linear-gradient(#0079CA,#005E9C);
  91. -moz-box-shadow: inset 0 0 0 0 #0076c4;
  92. -webkit-box-shadow: inset 0 0 0 0 #0076c4;
  93. -o-box-shadow: inset 0 0 0 0 #0076c4;
  94. box-shadow: inset 0 0 0 0 #0076c4;
  95. }
  96. button:active {
  97. background-image: -webkit-gradient(linear,50% 0,50% 100%,color-stop(0%,#00395E),color-stop(100%,#005891));
  98. background-image: -webkit-linear-gradient(#00395E,#005891);
  99. background-image: -moz-linear-gradient(#00395E,#005891);
  100. background-image: -o-linear-gradient(#00395E,#005891);
  101. background-image: -ms-linear-gradient(#00395E,#005891);
  102. background-image: linear-gradient(#00395E,#005891);
  103. }
  104. button:disabled,
  105. button[disabled] {
  106. opacity: 0.5;
  107. }
  108. input {
  109. color: black;
  110. cursor: auto;
  111. display: inline-block;
  112. font-family: 'Helvetica Neue', Helvetica;
  113. font-size: 25px;
  114. height: 30px;
  115. letter-spacing: normal;
  116. line-height: normal;
  117. margin: 2px 0px 2px 0px;
  118. padding: 5px;
  119. text-transform: none;
  120. vertical-align: baseline;
  121. width: 500px;
  122. word-spacing: 0px;
  123. }
  124. #password_match_info {
  125. margin-top: 0px;
  126. font-size: 13px;
  127. color: red;
  128. }
  129. </style>
  130. </head>
  131. <body>
  132. <h1>Reset Your Password<span id='app'></span></h1>
  133. <noscript>We apologize, but resetting your password requires javascript</noscript>
  134. <div class='error' id='error'></div>
  135. <form id='form' action='#' method='POST'>
  136. <label>New Password for <span id='username_label'></span></label>
  137. <span>New Password</span>
  138. <input name="new_password" type="password" id="password"/> <br>
  139. <span>Confirm New Password</span>
  140. <input name="confirm_new_password" type="password" id="password_confirm"/>
  141. <span id="password_match_info"></span>
  142. <input name='utf-8' type='hidden' value='✓' />
  143. <input name="username" id="username" type="hidden" />
  144. <input name="token" id="token" type="hidden" />
  145. <button id="change_password">Change Password</button>
  146. </form>
  147. <script language='javascript' type='text/javascript'>
  148. <!--
  149. window.onload = function() {
  150. var urlParams = {};
  151. (function () {
  152. var pair, // Really a match. Index 0 is the full match; 1 & 2 are the key & val.
  153. tokenize = /([^&=]+)=?([^&]*)/g,
  154. // decodeURIComponents escapes everything but will leave +s that should be ' '
  155. re_space = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); },
  156. // Substring to cut off the leading '?'
  157. querystring = window.location.search.substring(1);
  158. while (pair = tokenize.exec(querystring))
  159. urlParams[re_space(pair[1])] = re_space(pair[2]);
  160. })();
  161. var id = urlParams['id'];
  162. var base = PARSE_SERVER_URL;
  163. document.getElementById('form').setAttribute('action', base + '/apps/' + id + '/request_password_reset');
  164. document.getElementById('username').value = urlParams['username'];
  165. document.getElementById('username_label').appendChild(document.createTextNode(urlParams['username']));
  166. document.getElementById("password").oninput = validatePassword;
  167. document.getElementById("password_confirm").oninput = validatePassword;
  168. document.getElementById("change_password").disabled = true;
  169. document.getElementById('token').value = urlParams['token'];
  170. if (urlParams['error']) {
  171. document.getElementById('error').appendChild(document.createTextNode(urlParams['error']));
  172. }
  173. if (urlParams['app']) {
  174. document.getElementById('app').appendChild(document.createTextNode(' for ' + urlParams['app']));
  175. }
  176. function validatePassword() {
  177. var pass2 = document.getElementById("password").value;
  178. var pass1 = document.getElementById("password_confirm").value;
  179. if(pass1 !== pass2) {
  180. if(document.getElementById("password_confirm").value) {
  181. document.getElementById("change_password").disabled = true;
  182. document.getElementById("password_match_info").innerHTML = "Must match the previous entry";
  183. }
  184. } else {
  185. document.getElementById("change_password").disabled = false;
  186. document.getElementById("password_match_info").innerHTML = "";
  187. }
  188. //empty string means no validation error
  189. }
  190. }
  191. //-->
  192. </script>
  193. </body>