login.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. include 'common.php';
  3. if ($user->hasLogin()) {
  4. $response->redirect($options->adminUrl);
  5. }
  6. $rememberName = htmlspecialchars(\Typecho\Cookie::get('__typecho_remember_name', ''));
  7. \Typecho\Cookie::delete('__typecho_remember_name');
  8. $bodyClass = 'body-100';
  9. include 'header.php';
  10. ?>
  11. <div class="typecho-login-wrap">
  12. <div class="typecho-login">
  13. <h1><a href="https://typecho.org" class="i-logo">Typecho</a></h1>
  14. <form action="<?php $options->loginAction(); ?>" method="post" name="login" role="form">
  15. <p>
  16. <label for="name" class="sr-only"><?php _e('用户名'); ?></label>
  17. <input type="text" id="name" name="name" value="<?php echo $rememberName; ?>" placeholder="<?php _e('用户名'); ?>" class="text-l w-100" autofocus />
  18. </p>
  19. <p>
  20. <label for="password" class="sr-only"><?php _e('密码'); ?></label>
  21. <input type="password" id="password" name="password" class="text-l w-100" placeholder="<?php _e('密码'); ?>" />
  22. </p>
  23. <p class="submit">
  24. <button type="submit" class="btn btn-l w-100 primary"><?php _e('登录'); ?></button>
  25. <input type="hidden" name="referer" value="<?php echo $request->filter('html')->get('referer'); ?>" />
  26. </p>
  27. <p>
  28. <label for="remember">
  29. <input<?php if(\Typecho\Cookie::get('__typecho_remember_remember')): ?> checked<?php endif; ?> type="checkbox" name="remember" class="checkbox" value="1" id="remember" /> <?php _e('下次自动登录'); ?>
  30. </label>
  31. </p>
  32. </form>
  33. <p class="more-link">
  34. <a href="<?php $options->siteUrl(); ?>"><?php _e('返回首页'); ?></a>
  35. <?php if($options->allowRegister): ?>
  36. &bull;
  37. <a href="<?php $options->registerUrl(); ?>"><?php _e('用户注册'); ?></a>
  38. <?php endif; ?>
  39. </p>
  40. </div>
  41. </div>
  42. <?php
  43. include 'common-js.php';
  44. ?>
  45. <script>
  46. $(document).ready(function () {
  47. $('#name').focus();
  48. });
  49. </script>
  50. <?php
  51. include 'footer.php';
  52. ?>