123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <div class="login-page">
- <div class="form col-md-12">
- <div>
- <h4>Login</h4>
- </div>
- <div v-if="hasError">
- <alert :text="errorMessage" :type="'ERROR'" />
- </div>
- <div class="row">
- <div class="col-md-12" style="margin-bottom: 1em">
- <div class="input-group mb-3">
- <div class="input-group-prepend">
- <span class="input-group-text">
- <eva-icon name="person-outline" fill="#24aae1"></eva-icon>
- </span>
- <input
- class="form-control"
- type="text"
- placeholder="Email Address"
- v-model="auth.emailAddress"
- value
- />
- </div>
- </div>
- <div class="input-group mb-3">
- <div class="input-group-prepend">
- <span class="input-group-text">
- <eva-icon name="lock-outline" fill="#24aae1"></eva-icon>
- </span>
- <input
- class="form-control"
- :type="isPasswordShown"
- v-model="auth.password"
- id="password"
- placeholder="Password"
- value
- />
- <div class="input-group-append">
- <span class="input-group-text" @click="togglePassword()">
- <eva-icon v-if="showPassword" name="eye-off-outline" fill="#24aae1"></eva-icon>
- <eva-icon v-else name="eye-outline" fill="#24aae1"></eva-icon>
- </span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <button @click="Login()" class="btn btn-b-n" type="button">Login</button>
- </div>
- </div>
- </template>
-
- <script>
- import { mapState, mapActions } from "vuex";
- import alert from "../shared/alert";
-
- export default {
- name: "Login",
- components: {
- alert
- },
- data() {
- return {
- isPasswordShown: "password",
- showPassword: false,
- hasError: false,
- errorMessage: ""
- };
- },
- methods: {
- ...mapActions("authentiaction", [
- "getAuthentication",
- "checkAuthentication"
- ]),
- Login() {
- this.checkAuthentication(this.auth).then(() => {
- //console.log(JSON.stringify(this.$store.state.authentiaction.result));
- // if (this.$store.state.auth.result === "Access Granted") {
- // console.log(JSON.stringify(this.$store.state.auth));
- // this.$router.push("/");
- // } else {
- // console.log(JSON.stringify(this.auth));
- // this.hasError = true;
- // this.errorMessage = this.$store.state.auth.result;
- // }
- if (this.auth.result === "Access Granted") {
- alert("Yes");
- } else {
- alert("No");
- }
- });
- },
- togglePassword() {
- if (this.showPassword) {
- this.isPasswordShown = "password";
- } else {
- this.isPasswordShown = "text";
- }
-
- this.showPassword = !this.showPassword;
- }
- },
- computed: {
- ...mapState("authentiaction", ["auth", "result"])
- },
- mounted() {
- this.getAuthentication();
- },
- watch: {
- auth(value) {
- return value;
- }
- }
- };
- </script>
|