reset.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <?php
  2. #重置密码
  3. require_once '../path.php';
  4. require_once "../public/load_lang.php";
  5. require_once "../public/function.php";
  6. if (!isset($_GET["token"])) {
  7. }
  8. ?>
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  13. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  14. <link type="text/css" rel="stylesheet" href="../studio/css/font.css"/>
  15. <link type="text/css" rel="stylesheet" href="../studio/css/style.css"/>
  16. <link type="text/css" rel="stylesheet" href="../studio/css/color_day.css" id="colorchange" />
  17. <title>wikipali reset password</title>
  18. <script src="../public/js/comm.js"></script>
  19. <script src="../studio/js/jquery-3.3.1.min.js"></script>
  20. <script src="../studio/js/fixedsticky.js"></script>
  21. <style>
  22. #login_body{
  23. display: flex;
  24. padding: 2em;
  25. margin: auto;
  26. }
  27. #login_left {
  28. padding-right: 12em;
  29. padding-top: 5em;
  30. }
  31. .title{
  32. font-size: 150%;
  33. margin-top: 1em;
  34. margin-bottom: 0.5em;
  35. }
  36. #login_form{
  37. padding: 2em 0 1em 0;
  38. }
  39. #tool_bar {
  40. padding: 1em;
  41. display: flex;
  42. justify-content: space-between;
  43. }
  44. #login_shortcut {
  45. display: flex;
  46. flex-direction: column;
  47. padding: 2em 0;
  48. }
  49. #login_shortcut button{
  50. height:3em;
  51. }
  52. #button_area{
  53. text-align: right;
  54. padding: 1em 0;
  55. }
  56. .form_help{
  57. font-weight: 400;
  58. color: var(--bookx);
  59. }
  60. .login_form input{
  61. margin-top:2em;
  62. padding:0.5em 0.5em;
  63. }
  64. .login_form select{
  65. margin-top:2em;
  66. padding:0.5em 0.5em;
  67. }
  68. .login_form input[type="submit"]{
  69. margin-top:2em;
  70. padding:0.1em 0.5em;
  71. }
  72. .form_error{
  73. color:var(--error-text);
  74. }
  75. #login_form_div{
  76. width:30em;
  77. }
  78. #ucenter_body {
  79. display: flex;
  80. flex-direction: column;
  81. margin: 0;
  82. padding: 0;
  83. background-color: var(--tool-bg-color3);
  84. color: var(--btn-color);
  85. }
  86. .icon_big {
  87. height: 2em;
  88. width: 2em;
  89. fill: var(--btn-color);
  90. transition: all 0.2s ease;
  91. }
  92. .form_field_name{
  93. position: absolute;
  94. margin-left: 7px;
  95. margin-top: 2em;
  96. color: var(--btn-border-line-color);
  97. -webkit-transition-duration: 0.4s;
  98. -moz-transition-duration: 0.4s;
  99. transition-duration: 0.4s;
  100. transform: translateY(0.5em);
  101. }
  102. .viewswitch_on {
  103. position: absolute;
  104. margin-left: 7px;
  105. margin-top: 1.5em;
  106. color: var(--bookx);
  107. -webkit-transition-duration: 0.4s;
  108. -moz-transition-duration: 0.4s;
  109. transition-duration: 0.4s;
  110. transform: translateY(-15px);
  111. }
  112. </style>
  113. <script>
  114. function login_init(){
  115. $("input").focus(function(){
  116. let name = $(this).attr("name");
  117. var objNave = document.getElementById("tip_"+name);
  118. objNave.className = "viewswitch_on";
  119. });
  120. $(".form_field_name").click(function(){
  121. let id = $(this).attr("id");
  122. var objNave = document.getElementById(id);
  123. objNave.className = "viewswitch_on";
  124. let arrId=id.split("_");
  125. document.getElementById('input_'+arrId[1]).focus();
  126. });
  127. }
  128. </script>
  129. <link type="text/css" rel="stylesheet" href="mobile.css" media="screen and (max-width:800px)">
  130. </head>
  131. <body id="ucenter_body" onload="login_init()">
  132. <div id="tool_bar">
  133. </div>
  134. <div id="login_body" >
  135. <div id="login_left">
  136. <div >
  137. <svg style="height: 8em;width: 25em;">
  138. <use xlink:href="../public/images/svg/wikipali_login_page.svg#logo_login"></use>
  139. </svg>
  140. </div>
  141. <div style=" padding: 1em 0 0 3.5em;font-weight: 400;">
  142. <?php echo $_local->gui->pali_literature_platform; ?>
  143. <ul style="padding-left: 1.2em;">
  144. <li><?php echo $_local->gui->online_dict_db; ?></li>
  145. <li><?php echo $_local->gui->user_data_share; ?></li>
  146. <li><?php echo $_local->gui->cooperate_edit; ?></li>
  147. </ul>
  148. </div>
  149. </div>
  150. <div id="login_right">
  151. <div id = "login_form_div" class="fun_block" >
  152. <div class="title">
  153. 重置密码
  154. </div>
  155. <div class="login_new">
  156. <span class="form_help"><?php echo $_local->gui->have_account; ?> ?</span><a href="index.php?language=<?php echo $currLanguage; ?>">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $_local->gui->login; //登入账户 ?></a>
  157. </div>
  158. <?php
  159. if (!isset($_GET["token"])) {
  160. echo '<div class="form_error">';
  161. echo "无效的密钥";
  162. echo '</div>';
  163. }else{
  164. ?>
  165. <div class="login_form" style=" padding: 3em 0 3em 0;">
  166. <div class="form_help" id="message"> </div>
  167. <form action="index.php" method="post">
  168. <div>
  169. <div>
  170. <span id='tip_username' class='form_field_name'><?php echo $_local->gui->account; ?></span>
  171. <input type="input" id="username" name="username" value="" />
  172. </div>
  173. <div id="error_username" class="form_error"> </div>
  174. <div class="form_help"></div>
  175. </div>
  176. <div>
  177. <div>
  178. <span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
  179. <input type="password" id="password" name="password" placeholder="密码" value="" />
  180. <input type="password" id="repassword" name="repassword" placeholder="再次输入密码" value="" />
  181. </div>
  182. <div class="form_help">至少6个字符</div>
  183. <div id="error_password" class="form_error"></div>
  184. </div>
  185. <input type="hidden" id="token" name="token" value="<?php echo $_REQUEST["token"]; ?>" />
  186. </form>
  187. <div id="button_area">
  188. <button onclick="submit()" style="background-color: var(--link-hover-color);border-color: var(--link-hover-color);" >
  189. <?php echo $_local->gui->continue; ?>
  190. </button>
  191. </div>
  192. </div>
  193. <?php
  194. }
  195. ?>
  196. </div>
  197. </div>
  198. </div>
  199. <script>
  200. login_init();
  201. function submit(){
  202. $.ajax({
  203. type: 'POST',
  204. url:"../api/user.php?_method=reset_pwd",
  205. contentType:"application/json; charset=utf-8",
  206. data:JSON.stringify(
  207. {
  208. username:$("#username").val(),
  209. password:$("#password").val(),
  210. reset_password_token:$("#token").val()
  211. }),
  212. dataType:"json"
  213. }).done(function (data) {
  214. $("#message").text(data.message);
  215. if(data.ok){
  216. $("#message").removeClass("form_error");
  217. }else{
  218. $("#message").addClass("form_error");
  219. }
  220. }).fail(function(jqXHR, textStatus, errorThrown){
  221. $("#message").removeClass("form_error");
  222. $("#message").text(textStatus);
  223. switch (textStatus) {
  224. case "timeout":
  225. break;
  226. case "error":
  227. switch (jqXHR.status) {
  228. case 404:
  229. break;
  230. case 500:
  231. break;
  232. default:
  233. break;
  234. }
  235. break;
  236. case "abort":
  237. break;
  238. case "parsererror":
  239. console.log("delete-parsererror",jqXHR.responseText);
  240. break;
  241. default:
  242. break;
  243. }
  244. });
  245. }
  246. </script>
  247. </body>
  248. </html>