Fix license verification flow
This commit is contained in:
parent
677d8dbf44
commit
26a342c5a5
|
|
@ -1,6 +1,7 @@
|
|||
mutation Login($input: LoginInput!) {
|
||||
login(input: $input) {
|
||||
success
|
||||
message
|
||||
errors {
|
||||
field
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,12 +153,13 @@ router.beforeEach(async (to, from, next) => {
|
|||
next({name: 'login'});
|
||||
return;
|
||||
}
|
||||
getCookieValue('loginStatus')
|
||||
|
||||
if (unauthorizedAccess(to)) {
|
||||
const redirectUrl = `/login?redirect=${to.path}`;
|
||||
next(redirectUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((to.name !== 'noClass' && to.name !== 'licenseActivation') && loginRequired(to) && await redirectStudentsWithoutClass()) {
|
||||
next({name: 'noClass'})
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,13 @@ export default {
|
|||
this.loading = false;
|
||||
if (data.registration.success) {
|
||||
this.keyValid = true;
|
||||
this.$router.push('/');
|
||||
|
||||
if (data.registration.message === 'no_valid_license') {
|
||||
this.$router.push({name: 'licenseActivation'});
|
||||
} else {
|
||||
this.$router.push('/');
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (data.registration.errors[0].field) {
|
||||
case 'invalid_key':
|
||||
|
|
|
|||
|
|
@ -101,7 +101,10 @@ export default {
|
|||
coupon: '',
|
||||
couponErrors: [],
|
||||
loginError: '',
|
||||
submitted: false
|
||||
submitted: false,
|
||||
me: {
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -90,8 +90,12 @@ export default {
|
|||
) {
|
||||
try {
|
||||
if (login.success) {
|
||||
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/';
|
||||
that.$router.push(redirectUrl);
|
||||
if (login.message === 'no_valid_license') {
|
||||
that.$router.push({name: 'licenseActivation'})
|
||||
} else {
|
||||
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/';
|
||||
that.$router.push(redirectUrl);
|
||||
}
|
||||
} else {
|
||||
const firstError = login.errors[0];
|
||||
switch (firstError.field) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue