This commit is contained in:
@@ -198,6 +198,8 @@ export default {
|
|||||||
authVerifyCode: null,
|
authVerifyCode: null,
|
||||||
cancel: null,
|
cancel: null,
|
||||||
pin: null,
|
pin: null,
|
||||||
|
tt: null,
|
||||||
|
loggedInWithKnownPassword: false,
|
||||||
hasSmallLogo: false,
|
hasSmallLogo: false,
|
||||||
hasMediumLogo: false,
|
hasMediumLogo: false,
|
||||||
hasLargeLogo: false,
|
hasLargeLogo: false,
|
||||||
@@ -368,22 +370,16 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async tfaVerify() {
|
async tfaVerify() {
|
||||||
//
|
//
|
||||||
//send 2fa code to server if ok, then proceed as normal
|
//send 2fa code to server if ok, then proceed as normal
|
||||||
let vm = this;
|
let vm = this;
|
||||||
if (vm.input.username != "" && vm.input.password != "") {
|
if (vm.pin && vm.pin != "") {
|
||||||
vm.errorBadCreds = false;
|
vm.errorBadCreds = false;
|
||||||
let loggedInWithKnownPassword =
|
|
||||||
vm.input.username == "superuser" && vm.input.password == "l3tm3in";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let res = await window.$gz.api.upsert(
|
let res = await window.$gz.api.post("auth/tfa-authenticate", {
|
||||||
"auth",
|
pin: vm.pin,
|
||||||
{
|
tempToken: vm.tt
|
||||||
login: vm.input.username,
|
});
|
||||||
password: vm.input.password
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
//don't expect this to ever get called but just in case
|
//don't expect this to ever get called but just in case
|
||||||
@@ -391,20 +387,7 @@ export default {
|
|||||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for 2fa enabled, if so then need to do one more step before process login can be called
|
await this.step2(res);
|
||||||
if (res.data.tfa) {
|
|
||||||
this.authTwoFactor = res.data.authTwoFactor;
|
|
||||||
this.authEnterPin = res.data.authEnterPin;
|
|
||||||
this.authVerifyCode = res.data.authVerifyCode;
|
|
||||||
this.cancel = res.data.cancel;
|
|
||||||
this.pin = null;
|
|
||||||
//prompt for 2fa
|
|
||||||
tfaDialog = true;
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.step2(res, loggedInWithKnownPassword);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//bad creds?
|
//bad creds?
|
||||||
if (
|
if (
|
||||||
@@ -439,11 +422,16 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
cancelTfaVerify() {
|
cancelTfaVerify() {
|
||||||
//todo: reset values here, reload page, ???
|
//todo: maybe redirect to login page instead??
|
||||||
this.tfaDialog=false;
|
let vm = this;
|
||||||
|
vm.tt = null;
|
||||||
|
vm.pin = null;
|
||||||
|
vm.errorBadCreds = false;
|
||||||
|
vm.input.username = null;
|
||||||
|
vm.input.password = null;
|
||||||
|
vm.tfaDialog = false;
|
||||||
},
|
},
|
||||||
showFooterLogo() {
|
showFooterLogo() {
|
||||||
return (
|
return (
|
||||||
@@ -499,7 +487,7 @@ export default {
|
|||||||
let vm = this;
|
let vm = this;
|
||||||
if (vm.input.username != "" && vm.input.password != "") {
|
if (vm.input.username != "" && vm.input.password != "") {
|
||||||
vm.errorBadCreds = false;
|
vm.errorBadCreds = false;
|
||||||
let loggedInWithKnownPassword =
|
vm.loggedInWithKnownPassword =
|
||||||
vm.input.username == "superuser" && vm.input.password == "l3tm3in";
|
vm.input.username == "superuser" && vm.input.password == "l3tm3in";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -523,15 +511,15 @@ export default {
|
|||||||
this.authTwoFactor = res.data.authTwoFactor;
|
this.authTwoFactor = res.data.authTwoFactor;
|
||||||
this.authEnterPin = res.data.authEnterPin;
|
this.authEnterPin = res.data.authEnterPin;
|
||||||
this.authVerifyCode = res.data.authVerifyCode;
|
this.authVerifyCode = res.data.authVerifyCode;
|
||||||
|
this.tt = res.data.tt;
|
||||||
this.cancel = res.data.cancel;
|
this.cancel = res.data.cancel;
|
||||||
this.pin = null;
|
this.pin = null;
|
||||||
//prompt for 2fa
|
//prompt for 2fa
|
||||||
tfaDialog = true;
|
tfaDialog = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.step2(res, loggedInWithKnownPassword);
|
await this.step2(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//bad creds?
|
//bad creds?
|
||||||
if (
|
if (
|
||||||
@@ -567,9 +555,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async step2(res, loggedInWithKnownPassword) {
|
async step2(res) {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
await processLogin(res.data, loggedInWithKnownPassword);
|
await processLogin(res.data, vm.loggedInWithKnownPassword);
|
||||||
|
|
||||||
//check if support and updates has expired and is paid for license and show warning if so
|
//check if support and updates has expired and is paid for license and show warning if so
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user