Skip to content

Modular logistics and supply chain operating system (LSOS)

updated 2fa page

TemuulenBMd314964776e5
diff --git a/console/app/components/two-fa-settings.js b/console/app/components/two-fa-settings.js
index 241b0de0..edf906f2 100644
--- a/console/app/components/two-fa-settings.js
+++ b/console/app/components/two-fa-settings.js
@@ -7,8 +7,10 @@ export default class TwoFaSettingsComponent extends Component {
@service fetch;
@service notifications;
- @tracked is2FAEnabled = false;
@tracked selected2FAMethod;
+ @tracked is2FAEnabled;
+ @tracked twoFaSettings;
+ @tracked isLoading;
TwoFaMethods = [
{ name: 'Authenticator App', description: 'Get codes from an app like Authy, 1Password, Microsoft Authenticator, or Google Authenticator', recommended: true },
diff --git a/console/app/controllers/console/admin/two-fa-settings.js b/console/app/controllers/console/admin/two-fa-settings.js
index 058797eb..4cdaeb4f 100644
--- a/console/app/controllers/console/admin/two-fa-settings.js
+++ b/console/app/controllers/console/admin/two-fa-settings.js
@@ -18,9 +18,9 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
*/
@service fetch;
- @tracked selected2FAMethod;
+ @tracked selected2FAMethod = null;
- @tracked is2FAEnabled;
+ @tracked is2FAEnabled = true;
/**
* The 2FA settings value JSON.
@@ -29,8 +29,8 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
* @var {Object}
*/
@tracked twoFaSettings = {
- selectedMethod: null,
- isEnabled: false,
+ Selected: this.selected2FAMethod,
+ Enabled: this.is2FAEnabled,
};
/**
@@ -41,8 +41,9 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
*/
@tracked isLoading = false;
- constructor(){
+ constructor() {
super(...arguments);
+ this.twoFaSettings;
}
/**
@@ -56,7 +57,7 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
@action saveSettings() {
const { twoFaSettings } = this;
- console.log('settings', twoFaSettings)
+ console.log('settings', twoFaSettings);
this.isLoading = true;
diff --git a/console/app/router.js b/console/app/router.js
index 913e0dae..562fb2cf 100644
--- a/console/app/router.js
+++ b/console/app/router.js
@@ -11,6 +11,7 @@ Router.map(function () {
this.route('login', { path: '/' });
this.route('forgot-password');
this.route('reset-password');
+ this.route('two-fa');
});
this.route('onboard', function () {
this.route('verify-email');
@@ -49,22 +50,22 @@ Router.map(function () {
this.mount('@fleetbase/dev-engine', {
as: 'developers',
- path: 'developers',
- });
-
- this.mount('@fleetbase/iam-engine', {
- as: 'iam',
- path: 'iam',
+ path: 'developers'
});
this.mount('@fleetbase/fleetops-engine', {
as: 'fleet-ops',
- path: 'fleet-ops',
+ path: 'fleet-ops'
+ });
+
+ this.mount('@fleetbase/iam-engine', {
+ as: 'iam',
+ path: 'iam'
});
this.mount('@fleetbase/storefront-engine', {
as: 'storefront',
- path: 'storefront',
+ path: 'storefront'
});
});
this.route('install');
diff --git a/console/app/templates/auth/two-fa.hbs b/console/app/templates/auth/two-fa.hbs
index b3d5178c..f7654b18 100644
--- a/console/app/templates/auth/two-fa.hbs
+++ b/console/app/templates/auth/two-fa.hbs
@@ -11,10 +11,24 @@
<FaIcon @icon="check-circle" @size="lg" class="text-green-900 mr-4" />
</div>
<p class="flex-1 text-sm text-green-900 dark:text-green-900">
- <strong>Check your SMS!</strong><br />
- We've sent you a verification code via SMS. Enter the code below to complete the login process.
+ <strong>Check your {{this.selectedMethod}}</strong><br />
+ We've sent you a verification code. Enter the code below to complete the login process.
</p>
</div>
+
+ <div class="mb-4">
+ <label for="mfaMethod" class="block text-sm font-medium text-gray-700 dark:text-gray-50">
+ Choose 2FA Method
+ </label>
+ <div class="mt-2">
+ <select id="mfaMethod" name="mfaMethod" class="form-select form-select-lg w-full" {{on "change" this.updateSelectedMethod}}>
+ <option value="sms">SMS</option>
+ <option value="email">Email</option>
+ <option value="authenticator">Authenticator App</option>
+ </select>
+ </div>
+ </div>
+
<form class="space-y-6" {{on "submit" this.verifyCode}}>
<div>
<label for="verificationCode" class="block text-sm font-medium text-gray-700 dark:text-gray-50">
@@ -33,6 +47,19 @@
</div>
</div>
+ <div class="text-right">
+ <a href="#" class="text-sm text-blue-500 hover:underline" {{on "click" this.resendCode}}>
+ Resend Code
+ </a>
+ </div>
+
+ <div class="flex items-center">
+ <input type="checkbox" id="rememberDevice" name="rememberDevice" class="form-checkbox" checked={{this.rememberDevice}} {{on "change" this.toggleRememberDevice}} />
+ <label for="rememberDevice" class="ml-2 text-sm text-gray-700 dark:text-gray-50">
+ Remember this device
+ </label>
+ </div>
+
<div class="flex flex-row space-x-2">
<Button @icon="check-circle" @type="primary" @buttonType="submit" @text="Verify Code" @onClick={{this.verifyCode}} @isLoading={{this.isLoading}} />
<Button @buttonType="button" @text="Cancel" @onClick={{fn (transition-to "auth.login")}} @disabled={{this.isLoading}} />
diff --git a/console/app/templates/console/admin/two-fa-settings.hbs b/console/app/templates/console/admin/two-fa-settings.hbs
index 73358689..cc0aaccb 100644
--- a/console/app/templates/console/admin/two-fa-settings.hbs
+++ b/console/app/templates/console/admin/two-fa-settings.hbs
@@ -7,7 +7,13 @@
<div class="container mx-auto h-screen" {{increase-height-by 1200}}>
<div class="max-w-3xl my-10 mx-auto space-y-4">
<ContentPanel @title="Two-Factor Authentication Settings" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
- <TwoFaSettings @twoFaSettings={{this.twoFaSettings}} @selected2FAMethod={{this.selected2FAMethod}} @is2FAEnabled={{this.is2FAEnabled}} @toggle2FA={{this.toggle2FA}}/>
+ <TwoFaSettings
+ @selected2FAMethod={{this.selected2FAMethod}}
+ @is2FAEnabled={{this.is2FAEnabled}}
+ @twoFaSettings={{this.twoFaSettings}}
+ @isLoading={{this.isLoading}}
+ @saveSettings={{this.saveSettings}}
+ />
</ContentPanel>
</div>
</div>