reset.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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>
  135. <div>
  136. <?php
  137. require_once '../lang/lang.php';
  138. ?>
  139. </div>
  140. </div>
  141. <div id="login_body" >
  142. <div id="login_left">
  143. <div >
  144. <svg style="height: 8em;width: 25em;">
  145. <use xlink:href="../public/images/svg/wikipali_login_page.svg#logo_login"></use>
  146. </svg>
  147. </div>
  148. <div style=" padding: 1em 0 0 3.5em;font-weight: 400;">
  149. <?php echo $_local->gui->pali_literature_platform; ?>
  150. <ul style="padding-left: 1.2em;">
  151. <li><?php echo $_local->gui->online_dict_db; ?></li>
  152. <li><?php echo $_local->gui->user_data_share; ?></li>
  153. <li><?php echo $_local->gui->cooperate_edit; ?></li>
  154. </ul>
  155. </div>
  156. </div>
  157. <div id="login_right">
  158. <div id = "login_form_div" class="fun_block" >
  159. <div class="title">
  160. 重置密码
  161. </div>
  162. <div class="login_new">
  163. <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>
  164. </div>
  165. <?php
  166. if (!isset($_GET["token"])) {
  167. echo '<div class="form_error">';
  168. echo "无效的密钥";
  169. echo '</div>';
  170. }else{
  171. ?>
  172. <div class="login_form" style=" padding: 3em 0 3em 0;">
  173. <div class="form_help" id="message"> </div>
  174. <div id="form_div">
  175. <form action="index.php" method="post">
  176. <div>
  177. <div>
  178. <span id='tip_username' class='form_field_name'><?php echo $_local->gui->account; ?></span>
  179. <input type="input" id="username" name="username" value="" />
  180. </div>
  181. <div id="error_username" class="form_error"> </div>
  182. <div class="form_help"></div>
  183. </div>
  184. <div>
  185. <div>
  186. <span id='tip_password' class='form_field_name'><?php echo $_local->gui->password; ?></span>
  187. <input type="password" id="password" name="password" placeholder="密码" value="" />
  188. <input type="password" id="repassword" name="repassword" placeholder="再次输入密码" value="" />
  189. </div>
  190. <div class="form_help">至少6个字符</div>
  191. <div id="error_password" class="form_error"></div>
  192. </div>
  193. <input type="hidden" id="token" name="token" value="<?php echo $_REQUEST["token"]; ?>" />
  194. </form>
  195. <div id="button_area">
  196. <button onclick="submit()" style="background-color: var(--link-hover-color);border-color: var(--link-hover-color);" >
  197. <?php echo $_local->gui->continue; ?>
  198. </button>
  199. </div>
  200. </div>
  201. </div>
  202. <?php
  203. }
  204. ?>
  205. </div>
  206. </div>
  207. </div>
  208. <script>
  209. login_init();
  210. function submit(){
  211. $.ajax({
  212. type: 'POST',
  213. url:"../api/user.php?_method=reset_pwd",
  214. contentType:"application/json; charset=utf-8",
  215. data:JSON.stringify(
  216. {
  217. username:$("#username").val(),
  218. password:$("#password").val(),
  219. reset_password_token:$("#token").val()
  220. }),
  221. dataType:"json"
  222. }).done(function (data) {
  223. if(data.ok){
  224. $("#form_div").hide();
  225. $("#message").removeClass("form_error");
  226. $("#message").html("密码修改成功。<a href='index.php?op=login'>登录</a>");
  227. }else{
  228. $("#message").addClass("form_error");
  229. $("#message").text(data.message);
  230. }
  231. }).fail(function(jqXHR, textStatus, errorThrown){
  232. $("#message").removeClass("form_error");
  233. $("#message").text(textStatus);
  234. switch (textStatus) {
  235. case "timeout":
  236. break;
  237. case "error":
  238. switch (jqXHR.status) {
  239. case 404:
  240. break;
  241. case 500:
  242. break;
  243. default:
  244. break;
  245. }
  246. break;
  247. case "abort":
  248. break;
  249. case "parsererror":
  250. console.log("delete-parsererror",jqXHR.responseText);
  251. break;
  252. default:
  253. break;
  254. }
  255. });
  256. }
  257. </script>
  258. </body>
  259. </html>