This commit is contained in:
2021-03-12 19:18:03 +00:00
parent 09807a1c85
commit ca13d081fc
3 changed files with 19 additions and 9 deletions

View File

@@ -203,6 +203,8 @@ todo: 2fa is going to be an absolute must have pretty soon, look into what's inv
if they match / pass then the normal token is sent back and login proceeds as normal if they match / pass then the normal token is sent back and login proceeds as normal
NO TOKEN IS SENT ON 2fa enabled account without pin verification NO TOKEN IS SENT ON 2fa enabled account without pin verification
TODO: failed login tries to navigate to login again, should carve out an exception in api no?
todo: tag search in picklist, does it support more than one tag? I forget todo: tag search in picklist, does it support more than one tag? I forget

View File

@@ -13,8 +13,6 @@ export function processLogin(authResponse, loggedInWithKnownPassword) {
return reject(); return reject();
} }
//is token present? //is token present?
if (!authResponse || !authResponse.token) { if (!authResponse || !authResponse.token) {
window.$gz.store.commit( window.$gz.store.commit(

View File

@@ -11,6 +11,7 @@
v-model="pin" v-model="pin"
:label="authEnterPin" :label="authEnterPin"
required required
:error-messages="pinError"
></v-text-field> ></v-text-field>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@@ -196,9 +197,11 @@ export default {
authTwoFactor: null, authTwoFactor: null,
authEnterPin: null, authEnterPin: null,
authVerifyCode: null, authVerifyCode: null,
authPinInvalid: null,
cancel: null, cancel: null,
pin: null, pin: null,
tt: null, tt: null,
pinError: null,
loggedInWithKnownPassword: false, loggedInWithKnownPassword: false,
hasSmallLogo: false, hasSmallLogo: false,
hasMediumLogo: false, hasMediumLogo: false,
@@ -373,13 +376,17 @@ export default {
//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.pin && vm.pin != "") { if (vm.pin && vm.pin != "") {
vm.errorBadCreds = false; vm.pinError = null;
try { try {
let res = await window.$gz.api.post("auth/tfa-authenticate", { let res = await window.$gz.api.upsert(
pin: vm.pin, "auth/tfa-authenticate",
tempToken: vm.tt {
}); pin: vm.pin,
tempToken: vm.tt
},
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
@@ -389,12 +396,13 @@ export default {
await this.step2(res); await this.step2(res);
} catch (error) { } catch (error) {
//bad creds? //bad PIN?
if ( if (
error.message && error.message &&
error.message.includes("ErrorUserNotAuthenticated") error.message.includes("ErrorUserNotAuthenticated")
) { ) {
vm.errorBadCreds = true; vm.pinError = vm.authPinInvalid;
return; return;
} }
//server closed by server state setting? //server closed by server state setting?
@@ -429,6 +437,7 @@ export default {
vm.tt = null; vm.tt = null;
vm.pin = null; vm.pin = null;
vm.errorBadCreds = false; vm.errorBadCreds = false;
vm.pinError = [];
vm.input.username = null; vm.input.username = null;
vm.input.password = null; vm.input.password = null;
vm.tfaDialog = false; vm.tfaDialog = false;
@@ -511,6 +520,7 @@ 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.authPinInvalid = res.data.authPinInvalid;
this.tt = res.data.tt; this.tt = res.data.tt;
this.cancel = res.data.cancel; this.cancel = res.data.cancel;
this.pin = null; this.pin = null;