Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

loginPage.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. </div>
  10. <div class="row">
  11. <div class="col-md-11" style="margin-bottom: 1em">
  12. <div class="input-group mb-3">
  13. <div class="input-group-prepend">
  14. <span class="input-group-text">
  15. <eva-icon name="person" fill="#60CBEB"></eva-icon>
  16. </span>
  17. <input
  18. class="form-control"
  19. type="text"
  20. name="username"
  21. placeholder="Username"
  22. value
  23. />
  24. </div>
  25. </div>
  26. <div class="input-group mb-3">
  27. <div class="input-group-prepend">
  28. <span class="input-group-text">
  29. <eva-icon name="lock" fill="#60CBEB"></eva-icon>
  30. </span>
  31. <input
  32. class="form-control"
  33. :type="isPasswordShown"
  34. v-model="password"
  35. id="password"
  36. placeholder="Password"
  37. name="password"
  38. value
  39. />
  40. <div class="input-group-append">
  41. <span class="input-group-text">
  42. <eva-icon
  43. v-if="!showPassword"
  44. name="eye-off"
  45. fill="#60CBEB"
  46. @click="togglePassword()"
  47. ></eva-icon>
  48. <eva-icon v-else name="eye" fill="#60CBEB" @click="passwordToggled()"></eva-icon>
  49. </span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="form-group row"></div>
  56. <button @click="Login()" class="btn btn-b-n" type="submit">Sign In</button>
  57. <p v-if="user !== null">{{ user }}</p>
  58. </div>
  59. </form>
  60. <form id="forgot">
  61. <div class="form">
  62. <h5>Trouble signing in?</h5>
  63. <div>
  64. <div class="row">
  65. <div class="input-group-prepend">
  66. <span class="input-group-text">
  67. <eva-icon name="email" fill="#60CBEB"></eva-icon>
  68. </span>
  69. <input class="form-control" placeholder="Your Email" type="text" name="email" value />
  70. </div>
  71. </div>
  72. </div>
  73. <div class="form-group row"></div>
  74. <div class="offset-md-3 col-md-5">
  75. <button @click="SendMail()" class="btn btn-b-n" type="submit">Get Help</button>
  76. </div>
  77. </div>
  78. </form>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. const axios = require('axios');
  84. export default {
  85. name: 'Login',
  86. data() {
  87. return {
  88. username: '',
  89. user: null,
  90. isPasswordShown: 'password',
  91. selectItems: [{ text: 'password', value: 0 }],
  92. selectErrors: 'Some error with the field',
  93. select: null,
  94. textErrors: 'Some error with the field',
  95. text: '',
  96. showPassword: false,
  97. password: '',
  98. };
  99. },
  100. methods: {
  101. Login() {
  102. console.log(this.username + this.password);
  103. axios
  104. .post('http://localhost:57260/api/register/authenticate', {
  105. username: this.username,
  106. password: this.password,
  107. })
  108. .then(response => console.log(response.data));
  109. this.$router.push('/');
  110. },
  111. togglePassword() {
  112. this.showPassword = true;
  113. this.isPasswordShown = 'text';
  114. },
  115. passwordToggled() {
  116. this.showPassword = false;
  117. this.isPasswordShown = 'password';
  118. },
  119. authHeader() {
  120. const user = JSON.parse(localStorage.getItem('user'));
  121. if (user && user.token) {
  122. return { Authoriztion: `Bearer ${user.token}` };
  123. }
  124. return {};
  125. },
  126. SendMail() {},
  127. },
  128. };
  129. </script>
  130. <style>
  131. .goDown {
  132. margin-top: 150px;
  133. }
  134. </style>