This commit is contained in:
@@ -197,7 +197,7 @@ todo: 2fa is going to be an absolute must have pretty soon, look into what's inv
|
|||||||
User settings has a SECURITY section where control 2fa stuff
|
User settings has a SECURITY section where control 2fa stuff
|
||||||
user chooses 2fa button to setup, a dialog pops up sends a request to server at which point a secret key for 2fa is generated and stored in the User account
|
user chooses 2fa button to setup, a dialog pops up sends a request to server at which point a secret key for 2fa is generated and stored in the User account
|
||||||
and gets back the secret to display in a qr code on screen to searching
|
and gets back the secret to display in a qr code on screen to searching
|
||||||
/auth/setup-hotp
|
/auth/setup-totp
|
||||||
user is redirected to a client form with the qr code displayed for teh secret
|
user is redirected to a client form with the qr code displayed for teh secret
|
||||||
User gets QR code then displayed to sign up with auth software
|
User gets QR code then displayed to sign up with auth software
|
||||||
User has to enter a valid code to save or enable 2fa fully otherwise it's not enabled if they cancel out
|
User has to enter a valid code to save or enable 2fa fully otherwise it's not enabled if they cancel out
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
<v-form ref="form">
|
<v-form ref="form">
|
||||||
<v-row>
|
<v-row>
|
||||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||||
tfaEnabled:{{ tfaEnabled }}
|
<template v-if="tfaEnabled">
|
||||||
|
DISABLE TFA
|
||||||
ui here if tfa enabled then only option is disable tfa if not enabled
|
</template>
|
||||||
then user sees code to scan into tfa app
|
<template v-else>
|
||||||
|
ENABLE TFA
|
||||||
|
<img alt="Embedded QR Code" :src="qCode" />
|
||||||
|
{{ obj.s }}
|
||||||
|
</template>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-form>
|
</v-form>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -41,7 +45,14 @@ export default {
|
|||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||||
|
|
||||||
//fetch tfa secret and display here if tfa not enabled currently
|
//fetch tfa secret and display here if tfa not enabled currently
|
||||||
console.log("tfaEnabled:", this.tfaEnabled);
|
if (!this.tfaEnabled) {
|
||||||
|
let res = await window.$gz.api.get("auth/totp");
|
||||||
|
if (res.error) {
|
||||||
|
throw new Error(res.error);
|
||||||
|
} else {
|
||||||
|
this.obj = res.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -67,7 +78,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: {
|
obj: {
|
||||||
s: null, // = u.HotpSecret,
|
s: null, // = u.TotpSecret,
|
||||||
qr: null // = qrCodeImageAsBase64
|
qr: null // = qrCodeImageAsBase64
|
||||||
},
|
},
|
||||||
tfaEnabled: window.$gz.store.state.tfaEnabled,
|
tfaEnabled: window.$gz.store.state.tfaEnabled,
|
||||||
@@ -107,6 +118,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
canSave: function() {
|
canSave: function() {
|
||||||
return this.formState.valid && this.formState.dirty;
|
return this.formState.valid && this.formState.dirty;
|
||||||
|
},
|
||||||
|
qCode: function() {
|
||||||
|
return `data:image/png;base64,${this.obj.qr}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user