Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
few patches for 2fa implementation
Ronald A. Richardson9f37b15d8a5c
diff --git a/console/app/controllers/auth/two-fa.js b/console/app/controllers/auth/two-fa.jsindex e2fe17b4..1bb683f1 100644--- a/console/app/controllers/auth/two-fa.js+++ b/console/app/controllers/auth/two-fa.js@@ -119,7 +119,9 @@ export default class AuthTwoFaController extends Controller {*/@action async verifyCode(event) {// prevent form default behaviour- event.preventDefault();+ if (event && typeof event.preventDefault === 'function') {+ event.preventDefault();+ }try {const { token, verificationCode, clientToken, identity } = this;@@ -154,19 +156,23 @@ export default class AuthTwoFaController extends Controller {}@action async resendCode() {- try {- const { identity, clientToken } = this;+ // disable countdown timer+ this.countdownReady = false;- if (!clientToken) {- this.notifications.error('Invalid session. Please try again.');- return;- }-- await this.fetch.post('two-fa/resend-code', {+ try {+ const { identity } = this;+ const { clientToken } = await this.fetch.post('two-fa/resend-code', {identity,});- this.notifications.success('Verification code resent successfully.');+ if (clientToken) {+ this.clientToken = clientToken;+ this.twoFactorSessionExpiresAfter = this.getExpirationDateFromClientToken(clientToken);+ this.countdownReady = true;+ this.notifications.success('Verification code resent successfully.');+ } else {+ this.notifications.error('Unable to send verification code.');+ }} catch (error) {// Handle errors, show error notifications, etc.this.notifications.error('Error resending verification code. Please try again.');@@ -214,5 +220,6 @@ export default class AuthTwoFaController extends Controller {@action handleOtpInput(otpValue) {this.verificationCode = otpValue;+ this.verifyCode();}}diff --git a/console/app/templates/auth/two-fa.hbs b/console/app/templates/auth/two-fa.hbsindex 3894dc80..cf914841 100644--- a/console/app/templates/auth/two-fa.hbs+++ b/console/app/templates/auth/two-fa.hbs@@ -16,19 +16,21 @@</div><form class="mt-8" {{on "submit" this.verifyCode}}>- <div class="flex items-center justify-between mt-6">- <OtpInput @onInput={{this.handleOtpInput}}/>+ <div class="flex items-center justify-between my-6">+ <OtpInput @onInputCompleted={{this.handleOtpInput}} /></div>- {{#if this.countdownReady}}- <Countdown @expiry={{this.twoFactorSessionExpiresAfter}} />- {{/if}}+ <div id="otp-countdown-container" class="otp-countdown-container flex items-center justify-center h-12">+ {{#if this.countdownReady}}+ <Countdown @expiry={{this.twoFactorSessionExpiresAfter}} @countdownClass="text-lg" />+ {{/if}}+ </div>- <div class="mt-6">+ <div class="mt-4"><Button @buttonType="submit" @type="primary" @text="Verify Code" @icon="check-circle" @wrapperClass="btn-block" @isLoading={{this.isLoading}} /></div>- <div class="text-center">+ <div class="text-center mt-3.5"><a href="#" class="text-sm text-blue-500 hover:underline inline-block" {{on "click" this.resendCode}}>Resend Code</a>