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
Latest push
TemuulenBM9bd0cc17d978
diff --git a/console/app/controllers/auth/two-fa.js b/console/app/controllers/auth/two-fa.jsindex f8935c6c..e2fe17b4 100644--- a/console/app/controllers/auth/two-fa.js+++ b/console/app/controllers/auth/two-fa.js@@ -67,15 +67,6 @@ export default class AuthTwoFaController extends Controller {*/@tracked clientToken;- /**- * Tracked property representing the client token from the validated 2fa session.- *- * @property {number} clientToken- * @tracked- * @default null- */- @tracked newClientSessionToken;-/*** Tracked property for storing the verification code.*@@ -114,7 +105,7 @@ export default class AuthTwoFaController extends Controller {** @property {Array} queryParams*/- queryParams = ['token', 'clientToken', 'newClientSessionToken'];+ queryParams = ['token', 'clientToken'];constructor() {super(...arguments);@@ -131,22 +122,19 @@ export default class AuthTwoFaController extends Controller {event.preventDefault();try {- const { token, verificationCode, clientToken, identity, newClientSessionToken } = this;+ const { token, verificationCode, clientToken, identity } = this;- if (!clientToken && !newClientSessionToken) {+ if (!clientToken) {this.notifications.error('Invalid session. Please try again.');return;}- console.log("Verification Code to be verified:", verificationCode);-// Call the backend API to verify the entered verification codeconst { authToken } = await this.fetch.post('two-fa/verify-code', {token,verificationCode,clientToken,identity,- newClientSessionToken,});// If verification is successful, transition to the desired route@@ -167,36 +155,21 @@ export default class AuthTwoFaController extends Controller {@action async resendCode() {try {- const { identity, token, clientToken } = this;+ const { identity, clientToken } = this;if (!clientToken) {this.notifications.error('Invalid session. Please try again.');return;}-- // Call the backend API to resend the verification code- const response = await this.fetch.post('two-fa/resend-code', {- token: this.token,- identity: this.identity,- clientToken: this.clientToken,++ await this.fetch.post('two-fa/resend-code', {+ identity,});- // const { newClientSessionToken } = response;- const { newClientSessionToken, generatedVerificationCode } = response;-- if (newClientSessionToken) {- this.newClientSessionToken = newClientSessionToken;-- console.log("Generated Verification Code:", generatedVerificationCode);-- this.notifications.success('Verification code resent successfully.');- } else {- this.notifications.error('Failed to get a new client session token. Please try again.');- }+ this.notifications.success('Verification code resent successfully.');} catch (error) {- console.error('Error while resending verification code:', error);- // Handle the error, e.g., show an error notification- this.notifications.error('Failed to resend verification code. Please try again.');+ // Handle errors, show error notifications, etc.+ this.notifications.error('Error resending verification code. Please try again.');}}diff --git a/console/app/routes/auth/two-fa.js b/console/app/routes/auth/two-fa.jsindex 2581f9bf..18defca3 100644--- a/console/app/routes/auth/two-fa.js+++ b/console/app/routes/auth/two-fa.js@@ -44,10 +44,6 @@ export default class AuthTwoFaRoute extends Route {refreshModel: false,replace: true,},- newClientSessionToken: {- refreshModel: false,- replace: true,- },};/**@@ -58,7 +54,7 @@ export default class AuthTwoFaRoute extends Route {*/beforeModel(transition) {// validate 2fa session with server- let { token, clientToken, newClientSessionToken } = transition.to.queryParams;+ let { token, clientToken } = transition.to.queryParams;return this.session.store.restore().then(({ identity }) => {if (!identity) {@@ -67,15 +63,13 @@ export default class AuthTwoFaRoute extends Route {}return this.fetch- .post('two-fa/validate-session', { token, identity, clientToken, newClientSessionToken })- .then(({ clientToken, newClientSessionToken }) => {- const tokenToPersist = clientToken || newClientSessionToken;+ .post('two-fa/validate-session', { token, identity, clientToken })+ .then(({ clientToken }) => {// clear session data after validated 2fa sessionthis.session.store.persist({identity,- token: tokenToPersist,+ token,clientToken,- newClientSessionToken,});}).catch((error) => {@@ -93,9 +87,8 @@ export default class AuthTwoFaRoute extends Route {setupController(controller) {super.setupController(...arguments);- this.session.store.restore().then(({ clientToken, identity, newClientSessionToken }) => {+ this.session.store.restore().then(({ clientToken, identity }) => {controller.clientToken = clientToken;- controller.newClientSessionToken = newClientSessionToken;controller.identity = identity;controller.twoFactorSessionExpiresAfter = controller.getExpirationDateFromClientToken(clientToken);controller.countdownReady = true;