reset.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. <div id="form_div">
  168. <form action="index.php" method="post">
  169. <div>
  170. <div>
  171. <span id='tip_username' class='form_field_name'><?php echo $_local->gui->account; ?></span>
  172. <input type="input" id="username" name="username" value="" />
  173. </div>
  174. <div id="error_username" class="form_error"> </div>
  175. <div class="form_help"></div>
  176. </div>
  177. <div>
  178. <div>
  179. <span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
  180. <input type="password" id="password" name="password" placeholder="密码" value="" />
  181. <input type="password" id="repassword" name="repassword" placeholder="再次输入密码" value="" />
  182. </div>
  183. <div class="form_help">至少6个字符</div>
  184. <div id="error_password" class="form_error"></div>
  185. </div>
  186. <input type="hidden" id="token" name="token" value="<?php echo $_REQUEST["token"]; ?>" />
  187. </form>
  188. <div id="button_area">
  189. <button onclick="submit()" style="background-color: var(--link-hover-color);border-color: var(--link-hover-color);" >
  190. <?php echo $_local->gui->continue; ?>
  191. </button>
  192. </div>
  193. </div>
  194. </div>
  195. <?php
  196. }
  197. ?>
  198. </div>
  199. </div>
  200. </div>
  201. <script>
  202. login_init();
  203. function submit(){
  204. $.ajax({
  205. type: 'POST',
  206. url:"../api/user.php?_method=reset_pwd",
  207. contentType:"application/json; charset=utf-8",
  208. data:JSON.stringify(
  209. {
  210. username:$("#username").val(),
  211. password:$("#password").val(),
  212. reset_password_token:$("#token").val()
  213. }),
  214. dataType:"json"
  215. }).done(function (data) {
  216. if(data.ok){
  217. $("#form_div").hide();
  218. $("#message").removeClass("form_error");
  219. $("#message").html("密码修改成功。<a href='index.php?op=login'>登录</a>");
  220. }else{
  221. $("#message").addClass("form_error");
  222. $("#message").text(data.message);
  223. }
  224. }).fail(function(jqXHR, textStatus, errorThrown){
  225. $("#message").removeClass("form_error");
  226. $("#message").text(textStatus);
  227. switch (textStatus) {
  228. case "timeout":
  229. break;
  230. case "error":
  231. switch (jqXHR.status) {
  232. case 404:
  233. break;
  234. case 500:
  235. break;
  236. default:
  237. break;
  238. }
  239. break;
  240. case "abort":
  241. break;
  242. case "parsererror":
  243. console.log("delete-parsererror",jqXHR.responseText);
  244. break;
  245. default:
  246. break;
  247. }
  248. });
  249. }
  250. </script>
  251. </body>
  252. </html>