Add JWT to login forms
This commit is contained in:
parent
47c1ecc9bc
commit
ad69193ac0
8 changed files with 93 additions and 6 deletions
|
@ -82,16 +82,20 @@
|
|||
})
|
||||
.then(function (response) {
|
||||
if (response.data.complete) {
|
||||
return window.location = '/';
|
||||
localStorage.setItem('token', response.data.token);
|
||||
self.$store.dispatch('login');
|
||||
return window.location = response.data.intended;
|
||||
}
|
||||
|
||||
self.$props.user.password = '';
|
||||
self.$data.showSpinner = false;
|
||||
self.$router.push({name: 'checkpoint', query: {token: response.data.token}});
|
||||
self.$router.push({name: 'checkpoint', query: {token: response.data.login_token}});
|
||||
})
|
||||
.catch(function (err) {
|
||||
self.$props.user.password = '';
|
||||
self.$data.showSpinner = false;
|
||||
self.$store.dispatch('logout');
|
||||
|
||||
if (!err.response) {
|
||||
return console.error(err);
|
||||
}
|
||||
|
|
|
@ -49,9 +49,12 @@
|
|||
authentication_code: this.$data.code,
|
||||
})
|
||||
.then(function (response) {
|
||||
localStorage.setItem('token', response.data.token);
|
||||
self.$store.dispatch('login');
|
||||
window.location = response.data.intended;
|
||||
})
|
||||
.catch(function (err) {
|
||||
self.$store.dispatch('logout');
|
||||
if (!err.response) {
|
||||
return console.error(err);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue