login.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!-- Standard Meta -->
  5. <meta charset="utf-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  8. <script src="https://unpkg.com/vue/dist/vue.js"></script>
  9. <script src="https://unpkg.com/vue-i18n/dist/vue-i18n.js"></script>
  10. <!-- Site Properties -->
  11. <title>Login</title>
  12. <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
  13. <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js" integrity="sha256-t8GepnyPmw9t+foMh3mKNvcorqNHamSKtKRxxpUEgFI=" crossorigin="anonymous"></script>
  14. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" integrity="sha256-9mbkOfVho3ZPXfM7W8sV2SndrGDuh7wuyLjtsWeTI1Q=" crossorigin="anonymous" />
  15. <style type="text/css">
  16. body {
  17. background-color: #e3eaed;
  18. }
  19. body>.grid {
  20. height: 100%;
  21. }
  22. .image {
  23. margin-top: -100px;
  24. }
  25. .column {
  26. max-width: 450px;
  27. }
  28. .background-top {
  29. width: 100%;
  30. height: 290px;
  31. background-color: #0079ad;
  32. border-bottom: 1px solid #fff;
  33. position: absolute;
  34. top: 0;
  35. left: 0;
  36. z-index: -100;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="background-top"> </div>
  42. <div class="ui middle aligned center aligned grid">
  43. <div class="column" id="login">
  44. <h2 class="ui teal image header">
  45. <img src="asset/cuhk.png" class="image" style="width:100%">
  46. </h2>
  47. <form class="ui large form" action="/chklogin" method="POST">
  48. <div class="ui segment">
  49. <div class="field">
  50. <h3 class="ui header">Login to {{service-name}}</h3>
  51. <p style="text-align: left">
  52. Login with<br> Student: Student-ID@link.cuhk.edu.hk<br>Staff: alias@cuhk.edu.hk<br>
  53. </p>
  54. </div>
  55. <div class="field">
  56. <div class="ui left icon input">
  57. <i class="user icon"></i>
  58. <input type="text" name="email" placeholder="E-mail address">
  59. </div>
  60. </div>
  61. <div class="field">
  62. <div class="ui left icon input">
  63. <i class="lock icon"></i>
  64. <input type="password" name="password" placeholder="Password">
  65. </div>
  66. </div>
  67. <div class="ui fluid large blue submit button" v-html="$t('message.login')"></div>
  68. </div>
  69. <div class="ui error message"></div>
  70. <input type="hidden" name="response_type" value="{{response_type}}">
  71. <input type="hidden" name="client_id" value="{{client_id}}">
  72. <input type="hidden" name="redirect_uri" value="{{redirect_uri}}">
  73. <input type="hidden" name="scope" value="{{scope}}">
  74. <input type="hidden" name="state" value="{{state}}">
  75. <input type="hidden" name="nonce" value="{{nonce}}">
  76. </form>
  77. <div class="ui message">
  78. <img class="ui small image" src="asset/{{service-image}}">
  79. </div>
  80. <div class="ui dropdown">
  81. <div class="text">English (en-US)</div>
  82. <i class="dropdown icon"></i>
  83. <div class="menu">
  84. <div class="item">English (en-US)</div>
  85. <div class="item">中文 (zh-TW)</div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </body>
  91. <script>
  92. const messages = {
  93. en: {
  94. message: {
  95. login: 'login',
  96. }
  97. },
  98. tw: {
  99. message: {
  100. login: '登入',
  101. }
  102. },
  103. }
  104. const i18n = new VueI18n({
  105. locale: 'tw',
  106. messages,
  107. })
  108. new Vue({
  109. i18n
  110. }).$mount('#login')
  111. $(document)
  112. .ready(function() {
  113. $('.ui.form')
  114. .form({
  115. fields: {
  116. email: {
  117. identifier: 'email',
  118. rules: [{
  119. type: 'empty',
  120. prompt: 'Please enter your e-mail'
  121. }, {
  122. type: 'email',
  123. prompt: 'Please enter a valid e-mail'
  124. }]
  125. },
  126. password: {
  127. identifier: 'password',
  128. rules: [{
  129. type: 'empty',
  130. prompt: 'Please enter your password'
  131. }, {
  132. type: 'length[6]',
  133. prompt: 'Your password must be at least 6 characters'
  134. }]
  135. }
  136. }
  137. });
  138. });
  139. $('.ui.dropdown')
  140. .dropdown();
  141. </script>
  142. </html>