選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

loginPage.vue 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div class="container">
  3. <!-- eslint-disable max-len -->
  4. <div class="login-page">
  5. <form id="signIn">
  6. <div class="form">
  7. <div>
  8. <h4>Login</h4>
  9. <br />
  10. </div>
  11. <div v-if="this.$store.state.authentication.status === 'error'">
  12. <alert
  13. :text="'User doesn\'t exist or Username and Password is incorrect'"
  14. :type="'ERROR'"
  15. />
  16. </div>
  17. <div class="row">
  18. <div class="col-md-11" style="margin-bottom: 1em">
  19. <div class="input-group mb-3">
  20. <div class="input-group-prepend">
  21. <span class="input-group-text">
  22. <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
  23. </span>
  24. <input
  25. class="form-control"
  26. type="text"
  27. name="username"
  28. placeholder="Username"
  29. v-model="username"
  30. value
  31. />
  32. </div>
  33. </div>
  34. <div class="input-group mb-3">
  35. <div class="input-group-prepend">
  36. <span class="input-group-text">
  37. <eva-icon name="lock-outline" fill="#60CBEB"></eva-icon>
  38. </span>
  39. <input
  40. class="form-control"
  41. :type="isPasswordShown"
  42. v-model="password"
  43. id="password"
  44. placeholder="Password"
  45. name="password"
  46. value
  47. />
  48. <div class="input-group-append">
  49. <span class="input-group-text">
  50. <eva-icon
  51. v-if="!showPassword"
  52. name="eye-off-outline"
  53. fill="#60CBEB"
  54. @click="togglePassword()"
  55. ></eva-icon>
  56. <eva-icon v-else name="eye-outline" fill="#60CBEB" @click="passwordToggled()"></eva-icon>
  57. </span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="form-group row"></div>
  64. <button @click="Login()" class="btn btn-b-n" type="submit">Sign In</button>
  65. <p v-if="user !== null">{{ user }}</p>
  66. <hr />
  67. <button
  68. @click="routerGoTo('/user/register')"
  69. class="btn"
  70. style="margin:2px"
  71. type="button"
  72. >Registration</button>
  73. <button
  74. @click="routerGoTo('/user/registeragency')"
  75. class="btn"
  76. style="margin:2px"
  77. >Agency Registration</button>
  78. </div>
  79. </form>
  80. <form id="forgot">
  81. <div class="form">
  82. <h5>Trouble signing in?</h5>
  83. <div>
  84. <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
  85. <div class="row">
  86. <div class="input-group-prepend">
  87. <span class="input-group-text">
  88. <eva-icon name="email-outline" fill="#60CBEB"></eva-icon>
  89. </span>
  90. <input class="form-control" placeholder="Your Email" type="text" name="email" value />
  91. </div>
  92. </div>
  93. </div>
  94. <div class="form-group row"></div>
  95. <div class="offset-md-3 col-md-5">
  96. <button @click="SendMail()" class="btn btn-b-n" type="submit">Get Help</button>
  97. </div>
  98. </div>
  99. </form>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import { mapActions, mapState } from 'vuex';
  105. import alert from '../shared/alert.vue';
  106. export default {
  107. name: 'Login',
  108. components: {
  109. alert,
  110. },
  111. data() {
  112. return {
  113. username: '',
  114. user: null,
  115. isPasswordShown: 'password',
  116. selectItems: [{ text: 'password', value: 0 }],
  117. selectErrors: 'Some error with the field',
  118. select: null,
  119. textErrors: 'Some error with the field',
  120. text: '',
  121. showPassword: false,
  122. password: '',
  123. email: '',
  124. };
  125. },
  126. computed: {
  127. ...mapState('authentication', ['token', 'status']),
  128. },
  129. methods: {
  130. ...mapActions('authentication', ['login']),
  131. Login() {
  132. this.login({ username: this.username, password: this.password }).then(
  133. () => {
  134. if (this.$store.state.authentication.status === 'error') {
  135. this.$router.push('/user/login');
  136. }
  137. },
  138. );
  139. // .catch((err) => {
  140. // this.alertmes = true;
  141. // console.log(err);
  142. // });
  143. this.$router.push('/about/us');
  144. },
  145. togglePassword() {
  146. this.showPassword = true;
  147. this.isPasswordShown = 'text';
  148. },
  149. passwordToggled() {
  150. this.showPassword = false;
  151. this.isPasswordShown = 'password';
  152. },
  153. SendMail() {},
  154. routerGoTo(goTo) {
  155. console.log(goTo);
  156. this.$router.push(goTo);
  157. },
  158. },
  159. };
  160. </script>
  161. <style>
  162. .goDown {
  163. margin-top: 150px;
  164. }
  165. </style>