|
@@ -8,11 +8,12 @@
|
8
|
8
|
<h4>Login</h4>
|
9
|
9
|
<br />
|
10
|
10
|
</div>
|
11
|
|
- <!--<alert :text="'Login successful'" :type="'SUCCESS'" />
|
12
|
|
- <alert :text="'User does not exist, please register'" :type="'ERROR'" />
|
13
|
|
- <alert :text="'Username is incorrect'" :type="'WARNING'" />
|
14
|
|
- <alert :text="'Password is incorrect'" :type="'WARNING'" />
|
15
|
|
- <alert :text="'Caps Lock is on'" :type="'INFO'" />-->
|
|
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>
|
16
|
17
|
<div class="row">
|
17
|
18
|
<div class="col-md-11" style="margin-bottom: 1em">
|
18
|
19
|
<div class="input-group mb-3">
|
|
@@ -81,7 +82,7 @@
|
81
|
82
|
<div class="form">
|
82
|
83
|
<h5>Trouble signing in?</h5>
|
83
|
84
|
<div>
|
84
|
|
- <!--<alert :text="'Username & password request email sent'" :type="'SUCCESS'" />-->
|
|
85
|
+ <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
|
85
|
86
|
<div class="row">
|
86
|
87
|
<div class="input-group-prepend">
|
87
|
88
|
<span class="input-group-text">
|
|
@@ -103,12 +104,12 @@
|
103
|
104
|
|
104
|
105
|
<script>
|
105
|
106
|
import { mapActions, mapState } from 'vuex';
|
106
|
|
-// import alert from '../shared/alert.vue';
|
|
107
|
+import alert from '../shared/alert.vue';
|
107
|
108
|
|
108
|
109
|
export default {
|
109
|
110
|
name: 'Login',
|
110
|
111
|
components: {
|
111
|
|
- // alert,
|
|
112
|
+ alert,
|
112
|
113
|
},
|
113
|
114
|
data() {
|
114
|
115
|
return {
|
|
@@ -131,9 +132,17 @@ export default {
|
131
|
132
|
methods: {
|
132
|
133
|
...mapActions('authentication', ['login']),
|
133
|
134
|
Login() {
|
134
|
|
- this.login({ username: this.username, password: this.password })
|
135
|
|
- .then(() => this.router.push('/'))
|
136
|
|
- .catch(err => console.log(err));
|
|
135
|
+ this.login({ username: this.username, password: this.password }).then(
|
|
136
|
+ () => {
|
|
137
|
+ if (this.$store.state.authentication.status === 'error') {
|
|
138
|
+ this.$router.push('/user/login');
|
|
139
|
+ }
|
|
140
|
+ },
|
|
141
|
+ );
|
|
142
|
+ // .catch((err) => {
|
|
143
|
+ // this.alertmes = true;
|
|
144
|
+ // console.log(err);
|
|
145
|
+ // });
|
137
|
146
|
this.$router.push('/about/us');
|
138
|
147
|
},
|
139
|
148
|
togglePassword() {
|