Skip to content

Modular logistics and supply chain operating system (LSOS)

Created two-fa-enforcement component

TemuulenBM5db723b003a6
diff --git a/console/app/components/two-fa-enforcement-alert.hbs b/console/app/components/two-fa-enforcement-alert.hbs
new file mode 100644
index 00000000..351c82e7
--- /dev/null
+++ b/console/app/components/two-fa-enforcement-alert.hbs
@@ -0,0 +1,15 @@
+{{#if this.shouldRender}}
+ <InfoBlock class="bg-yellow-100 border-none">
+ <div class="flex flex-col md:flex-row items-start">
+ <p class="text-lg dark:text-gray-700 mb-2 md:mb-0">
+ To enhance the security of your account, your organization requires Two-Factor Authentication (2FA). Enable 2FA in your account settings for an additional layer of
+ protection.
+ </p>
+ <div class="flex items-center md:ml-4">
+ <Button class="py-2 px-4 rounded border-none mt-5 whitespace-nowrap" @type="warning" @buttonType="Button" @onClick={{this.transitionToTwoFactorSettings}}>
+ Enable 2FA
+ </Button>
+ </div>
+ </div>
+ </InfoBlock>
+{{/if}}
\ No newline at end of file
diff --git a/console/app/components/two-fa-enforcement-alert.js b/console/app/components/two-fa-enforcement-alert.js
new file mode 100644
index 00000000..d1060a9f
--- /dev/null
+++ b/console/app/components/two-fa-enforcement-alert.js
@@ -0,0 +1,73 @@
+import Component from '@glimmer/component';
+import { action } from '@ember/object';
+import { task } from 'ember-concurrency-decorators';
+import { inject as service } from '@ember/service';
+import { tracked } from '@glimmer/tracking';
+/**
+ * Glimmer component for handling notification enforcement.
+ *
+ * @class EnforceNotificationComponent
+ * @extends Component
+ */
+export default class TwoFaEnforcementAlertComponent extends Component {
+ /**
+ * Flag to determine whether the component should render or not.
+ *
+ * @property {boolean} shouldRender
+ * @default false
+ * @tracked
+ */
+ @tracked shouldRender = false;
+
+ /**
+ * Ember Router service for transitioning between routes.
+ *
+ * @type {RouterService}
+ */
+ @service router;
+
+ /**
+ * Fetch service for making HTTP requests.
+ *
+ * @property {FetchService} fetch
+ * @inject
+ */
+ @service fetch;
+
+ /**
+ * Constructor method for the ConsoleAccountAuthController.
+ *
+ * @constructor
+ */
+ constructor() {
+ super(...arguments);
+ this.checkTwoFactorEnforcement.perform();
+ }
+
+ /**
+ * Transition to the users auth page.
+ *
+ * @method transitionToTwoFa
+ * @memberof ConsoleHomeController
+ */
+ @action transitionToTwoFactorSettings() {
+ this.router.transitionTo('console.account.auth');
+ }
+
+ @task *checkTwoFactorEnforcement() {
+ const shouldRender = yield this.fetch.get('two-fa/enforce').catch((error) => {
+ this.notifications.serverError(error);
+ });
+
+ /**
+ * Task to check whether two-factor authentication enforcement is required.
+ *
+ * @method checkTwoFactorEnforcement
+ * @memberof TwoFaEnforcementAlertComponent
+ * @task
+ */
+ if (shouldRender) {
+ this.shouldRender = shouldRender.shouldEnforce;
+ }
+ }
+}
diff --git a/console/app/components/two-fa-settings.js b/console/app/components/two-fa-settings.js
index 5cbb04f3..5c659c77 100644
--- a/console/app/components/two-fa-settings.js
+++ b/console/app/components/two-fa-settings.js
@@ -84,6 +84,7 @@ export default class TwoFaSettingsComponent extends Component {
this.showEnforceOption = showEnforceOption === true;
this.isTwoFaEnabled = twoFaSettings.enabled === true;
+ this.isTwoFaEnforced = twoFaSettings.enforced === true;
this.selectedTwoFaMethod = userSelectedMethod ? userSelectedMethod.key : DEFAULT_2FA_METHOD;
}
@@ -147,4 +148,12 @@ export default class TwoFaSettingsComponent extends Component {
this.args.onTwoFaMethodSelected(...arguments);
}
}
+
+ @action onRequireUsersToSetUpToggled(isTwoFaEnforced) {
+ this.isTwoFaEnforced = isTwoFaEnforced;
+
+ if (typeof this.args.onTwoFaEnforcedToggled === 'function') {
+ this.args.onTwoFaEnforcedToggled(isTwoFaEnforced);
+ }
+ }
}
diff --git a/console/app/controllers/auth/two-fa.js b/console/app/controllers/auth/two-fa.js
index 0624572b..974293f1 100644
--- a/console/app/controllers/auth/two-fa.js
+++ b/console/app/controllers/auth/two-fa.js
@@ -166,7 +166,7 @@ export default class AuthTwoFaController extends Controller {
const { identity, token } = this;
const { clientToken } = await this.fetch.post('two-fa/resend', {
identity,
- token
+ token,
});
if (clientToken) {
diff --git a/console/app/controllers/console/account/auth.js b/console/app/controllers/console/account/auth.js
index 6487943f..b314b701 100644
--- a/console/app/controllers/console/account/auth.js
+++ b/console/app/controllers/console/account/auth.js
@@ -189,6 +189,7 @@ export default class ConsoleAccountAuthController extends Controller {
const twoFaSettings = yield this.fetch.get('users/two-fa');
if (twoFaSettings) {
+ this.isUserTwoFaEnabled = twoFaSettings.enabled;
this.twoFaSettings = twoFaSettings;
}
return twoFaSettings;
@@ -240,7 +241,6 @@ export default class ConsoleAccountAuthController extends Controller {
});
this.notifications.success('Password change successfully.');
- this.router.transitionTo('console');
} catch (error) {
this.notifications.error('Failed to change password');
}
diff --git a/console/app/controllers/console/admin/two-fa-settings.js b/console/app/controllers/console/admin/two-fa-settings.js
index a7b85df8..dd3025a9 100644
--- a/console/app/controllers/console/admin/two-fa-settings.js
+++ b/console/app/controllers/console/admin/two-fa-settings.js
@@ -13,46 +13,53 @@ import getTwoFaMethods from '@fleetbase/console/utils/get-two-fa-methods';
*/
export default class ConsoleAdminTwoFaSettingsController extends Controller {
/**
- * Inject the notifications service.
+ * Service for handling data fetching.
*
- * @memberof ConsoleAdminTwoFaSettingsController
+ * @type {fetch}
+ */
+ @service fetch;
+
+ /**
+ * Service for displaying notifications.
+ *
+ * @type {notifications}
*/
@service notifications;
/**
- * Inject the fetch service.
+ * System-wide two-factor authentication configuration.
*
- * @memberof ConsoleAdminTwoFaSettingsController
+ * @type {Object}
*/
- @service fetch;
+ @tracked twoFaConfig = {};
/**
- * Tracked property for the Two-Factor Authentication enabled state.
+ * User-specific two-factor authentication settings.
*
- * @memberof ConsoleAdminTwoFaSettingsController
- * @type {Boolean}
+ * @type {Object}
*/
- @tracked twoFaMethod = 'authenticator_app';
+ @tracked twoFaSettings = {};
/**
- * Array of available Two-Factor Authentication methods.
+ * Flag indicating whether system-wide two-factor authentication is enabled.
*
- * @memberof ConsoleAdminTwoFaSettingsController
- * @type {Array}
+ * @type {boolean}
*/
- @tracked methods = getTwoFaMethods();
+ @tracked isSystemTwoFaEnabled = false;
/**
- * The 2FA settings value JSON.
+ * Flag indicating whether 2FA enforcement is required.
*
- * @memberof ConsoleAdminNotificationsController
- * @var {Object}
+ * @type {boolean}
*/
- @tracked twoFaSettings = {
- enabled: false,
- enforced: false,
- method: 'email',
- };
+ @tracked isTwoFaEnforced = false;
+
+ /**
+ * Available two-factor authentication methods.
+ *
+ * @type {Array}
+ */
+ @tracked methods = getTwoFaMethods();
/**
* Tracked property for the loading state
@@ -63,7 +70,7 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
@tracked isLoading = false;
/**
- * Constructor method for the controller.
+ * Constructor method for the ConsoleAccountAuthController.
*
* @constructor
*/
@@ -73,40 +80,69 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
}
/**
- * Action method triggered when Two-Factor Authentication is toggled.
+ * Handles the event when two-factor authentication is toggled.
*
- * @action
- * @param {Boolean} isEnabled - The new state of Two-Factor Authentication.
+ * @method onTwoFaToggled
+ * @param {boolean} enabled - Whether two-factor authentication is enabled or not.
*/
- @action onTwoFaToggled(isEnabled) {
- this.isTwoFaEnabled = isEnabled;
+ @action onTwoFaToggled(enabled) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ enabled,
+ };
}
/**
- * Action method triggered when Two-Factor Authentication enforcement is toggled.
+ * Handles the event when a two-factor authentication method is selected.
*
- * @action
- * @param {Boolean} isEnabled - The new state of Two-Factor Authentication.
+ * @method onTwoFaMethodSelected
+ * @param {string} method - The selected two-factor authentication method.
*/
- @action onTwoFaEnforcedToggled(isEnabled) {
- this.onTwoFaEnforcedToggled = isEnabled;
+ @action onTwoFaMethodSelected(method) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ method,
+ };
}
/**
- * Action method triggered when a Two-Factor Authentication method is selected.
+ * Handles the event when two-factor authentication is toggled.
*
- * @action
- * @param {String} method - The selected Two-Factor Authentication method.
+ * @method onTwoFaToggled
+ * @param {boolean} enabled - Whether two-factor authentication is enforced or not.
*/
- @action onTwoFaMethodSelected(method) {
- this.twoFaMethod = method;
+ @action onTwoFaEnforceToggled(enforced) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ enforced,
+ };
+ }
+
+ /**
+ * Handles the event when 2FA enforcement is toggled.
+ *
+ * @method onTwoFaEnforceToggled
+ */
+
+ /**
+ * Initiates the task to save user-specific two-factor authentication settings asynchronously.
+ *
+ * @method saveTwoFactorAuthSettings
+ */
+ @action saveSettings() {
+ this.saveTwoFactorSettingsForAdmin.perform(this.twoFaSettings);
}
+ /**
+ * Initiates the task to load system-wide two-factor authentication configuration asynchronously.
+ *
+ * @method loadSystemTwoFaConfig
+ */
+
@task *loadSystemTwoFaConfig() {
const twoFaSettings = yield this.fetch.get('two-fa/config').catch((error) => {
this.notifications.serverError(error);
});
-
if (twoFaSettings) {
this.twoFaSettings = twoFaSettings;
}
@@ -115,26 +151,16 @@ export default class ConsoleAdminTwoFaSettingsController extends Controller {
}
/**
- * Save Two Factor settings to the server.
+ * Initiates the task to save user-specific two-factor authentication settings asynchronously.
*
- * @action
- * @method saveSettings
- * @returns {Promise}
- * @memberof ConsoleAdminTwoFaSettingsController
+ * @method saveTwoFactorSettingsForAdmin
+ * @param {Object} twoFaSettings - User-specific two-factor authentication settings.
*/
- @action saveSettings() {
- const twoFaSettings = {
- enabled: this.isTwoFaEnabled,
- enforced: this.isTwoFaEnforced,
- method: this.twoFaMethod,
- };
-
- this.isLoading = true;
-
- return this.fetch
+ @task *saveTwoFactorSettingsForAdmin(twoFaSettings = {}) {
+ yield this.fetch
.post('two-fa/config', { twoFaSettings })
.then(() => {
- this.notifications.success('2FA Configuration saved successfully.');
+ this.notifications.success('2FA Settings saved for admin successfully.');
})
.catch((error) => {
this.notifications.serverError(error);
diff --git a/console/app/controllers/console/settings/auth.js b/console/app/controllers/console/settings/auth.js
index f010a833..af8e543a 100644
--- a/console/app/controllers/console/settings/auth.js
+++ b/console/app/controllers/console/settings/auth.js
@@ -1,131 +1,3 @@
import Controller from '@ember/controller';
-import { tracked } from '@glimmer/tracking';
-import { action } from '@ember/object';
-import { inject as service } from '@ember/service';
-import { task } from 'ember-concurrency-decorators';
-import getTwoFaMethods from '@fleetbase/console/utils/get-two-fa-methods';
-export default class ConsoleSettingsAuthController extends Controller {
- /**
- * Service for handling data fetching.
- *
- * @type {fetch}
- */
- @service fetch;
-
- /**
- * Service for displaying notifications.
- *
- * @type {notifications}
- */
- @service notifications;
-
- /**
- * System-wide two-factor authentication configuration.
- *
- * @type {Object}
- */
- @tracked twoFaConfig = {};
-
- /**
- * User-specific two-factor authentication settings.
- *
- * @type {Object}
- */
- @tracked twoFaSettings = {};
-
- /**
- * Flag indicating whether system-wide two-factor authentication is enabled.
- *
- * @type {boolean}
- */
- @tracked isSystemTwoFaEnabled = false;
-
- /**
- * Available two-factor authentication methods.
- *
- * @type {Array}
- */
- @tracked methods = getTwoFaMethods();
-
- /**
- * Constructor method for the ConsoleAccountAuthController.
- *
- * @constructor
- */
- constructor() {
- super(...arguments);
- this.loadSystemTwoFaConfig.perform();
- this.loadCompanyTwoFaSettings.perform();
- }
-
- /**
- * Handles the event when two-factor authentication is toggled.
- *
- * @method onTwoFaToggled
- * @param {boolean} enabled - Whether two-factor authentication is enabled or not.
- */
- @action onTwoFaToggled(enabled) {
- this.twoFaSettings = {
- ...this.twoFaSettings,
- enabled,
- };
- }
-
- /**
- * Handles the event when a two-factor authentication method is selected.
- *
- * @method onTwoFaMethodSelected
- * @param {string} method - The selected two-factor authentication method.
- */
- @action onTwoFaMethodSelected(method) {
- this.twoFaSettings = {
- ...this.twoFaSettings,
- method,
- };
- }
-
- @action enforceTwoFaForCompanyUsersAction() {
- this.enforceTwoFaForCompanyUsers.perform(this.twoFaSettings);
- }
-
- /**
- * Initiates the task to load user-specific two-factor authentication settings asynchronously.
- *
- * @method loadUserTwoFaSettings
- */
- @task *loadCompanyTwoFaSettings() {
- const twoFaSettings = yield this.fetch.get('companies/two-fa');
-
- if (twoFaSettings) {
- this.twoFaSettings = twoFaSettings;
- }
- return twoFaSettings;
- }
-
- /**
- * Initiates the task to load system-wide two-factor authentication configuration asynchronously.
- *
- * @method loadSystemTwoFaConfig
- */
- @task *loadSystemTwoFaConfig() {
- const twoFaConfig = yield this.fetch.get('two-fa/config');
-
- if (twoFaConfig) {
- this.isSystemTwoFaEnabled = twoFaConfig.enabled;
- this.twoFaConfig = twoFaConfig;
- }
- return twoFaConfig;
- }
-
- @task *enforceTwoFaForCompanyUsers(twoFaSettings = {}) {
- yield this.fetch
- .post('companies/enforce', { twoFaSettings })
- .then(() => {
- this.notifications.success('2FA Settings enforced for all users successfully.');
- })
- .catch((error) => {
- this.notifications.serverError(error);
- });
- }
-}
+export default class ConsoleSettingsAuthController extends Controller {}
diff --git a/console/app/controllers/console/settings/two-fa.js b/console/app/controllers/console/settings/two-fa.js
new file mode 100644
index 00000000..f7baba66
--- /dev/null
+++ b/console/app/controllers/console/settings/two-fa.js
@@ -0,0 +1,184 @@
+import Controller from '@ember/controller';
+import { tracked } from '@glimmer/tracking';
+import { action } from '@ember/object';
+import { inject as service } from '@ember/service';
+import { task } from 'ember-concurrency-decorators';
+import getTwoFaMethods from '@fleetbase/console/utils/get-two-fa-methods';
+
+export default class ConsoleSettingsTwoFaController extends Controller {
+ /**
+ * Service for handling data fetching.
+ *
+ * @type {fetch}
+ */
+ @service fetch;
+
+ /**
+ * Service for displaying notifications.
+ *
+ * @type {notifications}
+ */
+ @service notifications;
+
+ /**
+ * System-wide two-factor authentication configuration.
+ *
+ * @type {Object}
+ */
+ @tracked twoFaConfig = {};
+
+ /**
+ * User-specific two-factor authentication settings.
+ *
+ * @type {Object}
+ */
+ @tracked twoFaSettings = {};
+
+ /**
+ * Flag indicating whether system-wide two-factor authentication is enabled.
+ *
+ * @type {boolean}
+ */
+ @tracked isSystemTwoFaEnabled = false;
+
+ /**
+ * Flag indicating whether system-wide two-factor authentication is enabled.
+ *
+ * @type {boolean}
+ */
+ @tracked isUserTwoFaEnabled = false;
+
+ /**
+ * Flag indicating whether 2FA enforcement is required.
+ *
+ * @type {boolean}
+ */
+ @tracked isTwoFaEnforced = false;
+
+ /**
+ * Available two-factor authentication methods.
+ *
+ * @type {Array}
+ */
+ @tracked methods = getTwoFaMethods();
+
+ /**
+ * Constructor method for the ConsoleAccountAuthController.
+ *
+ * @constructor
+ */
+ constructor() {
+ super(...arguments);
+ this.loadSystemTwoFaConfig.perform();
+ this.loadCompanyTwoFaSettings.perform();
+ this.loadUserTwoFaSettings.perform();
+ }
+
+ /**
+ * Handles the event when two-factor authentication is toggled.
+ *
+ * @method onTwoFaToggled
+ * @param {boolean} enabled - Whether two-factor authentication is enabled or not.
+ */
+ @action onTwoFaToggled(enabled) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ enabled,
+ };
+ }
+
+ /**
+ * Handles the event when a two-factor authentication method is selected.
+ *
+ * @method onTwoFaMethodSelected
+ * @param {string} method - The selected two-factor authentication method.
+ */
+ @action onTwoFaMethodSelected(method) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ method,
+ };
+ }
+
+ /**
+ * Handles the event when two-factor authentication is toggled.
+ *
+ * @method onTwoFaToggled
+ * @param {boolean} enabled - Whether two-factor authentication is enforced or not.
+ */
+ @action onTwoFaEnforceToggled(enforced) {
+ this.twoFaSettings = {
+ ...this.twoFaSettings,
+ enforced,
+ };
+ }
+
+ /**
+ * Initiates the task to save user-specific two-factor authentication settings asynchronously.
+ *
+ * @method saveTwoFactor
+ */
+ @action saveTwoFactor() {
+ this.saveTwoFactorSettingsForCompany.perform(this.twoFaSettings);
+ }
+
+ /**
+ * Initiates the task to load user-specific two-factor authentication settings asynchronously.
+ *
+ * @method loadUserTwoFaSettings
+ */
+ @task *loadCompanyTwoFaSettings() {
+ const twoFaSettings = yield this.fetch.get('companies/two-fa');
+ if (twoFaSettings) {
+ this.twoFaSettings = twoFaSettings;
+ this.isTwoFaEnforced = twoFaSettings.enforced;
+ }
+ return twoFaSettings;
+ }
+
+ /**
+ * Initiates the task to load system-wide two-factor authentication configuration asynchronously.
+ *
+ * @method loadSystemTwoFaConfig
+ */
+ @task *loadSystemTwoFaConfig() {
+ const twoFaConfig = yield this.fetch.get('two-fa/config');
+
+ if (twoFaConfig) {
+ this.isSystemTwoFaEnabled = twoFaConfig.enabled;
+ this.twoFaConfig = twoFaConfig;
+ }
+ return twoFaConfig;
+ }
+
+ /**
+ * Initiates the task to load user-specific two-factor authentication settings asynchronously.
+ *
+ * @method loadUserTwoFaSettings
+ */
+ @task *loadUserTwoFaSettings() {
+ const twoFaSettings = yield this.fetch.get('users/two-fa');
+ if (twoFaSettings) {
+ this.isUserTwoFaEnabled = twoFaSettings.enabled;
+ this.twoFaSettings = twoFaSettings;
+ }
+ return twoFaSettings;
+ }
+
+ /**
+ * Initiates the task to save user-specific two-factor authentication settings for the company asynchronously.
+ *
+ * @method saveTwoFactorSettingsForCompany
+ * @param {Object} twoFaSettings - User-specific two-factor authentication settings.
+ */
+ @task *saveTwoFactorSettingsForCompany(twoFaSettings = {}) {
+ yield this.fetch
+ .post('companies/two-fa', { twoFaSettings })
+ .then(() => {
+ this.notifications.success('2FA Settings saved for organization successfully.');
+ })
+ .catch((error) => {
+ this.notifications.serverError(error);
+ });
+ }
+}
diff --git a/console/app/router.js b/console/app/router.js
index ae840575..708e80c1 100644
--- a/console/app/router.js
+++ b/console/app/router.js
@@ -31,6 +31,7 @@ Router.map(function () {
this.route('settings', function () {
this.route('virtual', { path: '/:slug/:view' });
this.route('auth');
+ this.route('two-fa');
});
this.route('virtual', { path: '/:slug/:view' });
this.route('admin', function () {
@@ -52,22 +53,22 @@ Router.map(function () {
this.mount('@fleetbase/dev-engine', {
as: 'developers',
- path: 'developers'
+ path: 'developers',
});
this.mount('@fleetbase/iam-engine', {
as: 'iam',
- path: 'iam'
+ path: 'iam',
});
this.mount('@fleetbase/fleetops-engine', {
as: 'fleet-ops',
- path: 'fleet-ops'
+ path: 'fleet-ops',
});
this.mount('@fleetbase/storefront-engine', {
as: 'storefront',
- path: 'storefront'
+ path: 'storefront',
});
});
this.route('install');
diff --git a/console/app/routes/console/settings/two-fa.js b/console/app/routes/console/settings/two-fa.js
new file mode 100644
index 00000000..1de798c3
--- /dev/null
+++ b/console/app/routes/console/settings/two-fa.js
@@ -0,0 +1,3 @@
+import Route from '@ember/routing/route';
+
+export default class ConsoleSettingsTwoFaRoute extends Route {}
diff --git a/console/app/templates/console/account/auth.hbs b/console/app/templates/console/account/auth.hbs
index 63cc160b..8bd5ff84 100644
--- a/console/app/templates/console/account/auth.hbs
+++ b/console/app/templates/console/account/auth.hbs
@@ -6,15 +6,6 @@
<div class="max-w-3xl my-10 mx-auto space-y-6">
<ContentPanel @title="Change Password" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
{{#if this.isPasswordValidated}}
- <form id="validate-password-form" aria-label="validate-password" {{on "submit" this.validatePassword}}>
- <legend class="mb-3">Validate Current Password</legend>
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
- <InputGroup @name="Password" @type="password" @value={{this.password}} />
- <InputGroup @name="Confirm Password" @type="password" @value={{this.confirmPassword}} />
- </div>
- <Button @type="primary" @buttonType="submit" @text="Continue" @icon="check" {{on "click" this.validatePassword}} />
- </form>
- {{else}}
<form id="change-password-form" aria-label="change-password" {{on "submit" this.changeUserPassword}}>
<legend class="mb-3">Change Password</legend>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
@@ -23,6 +14,15 @@
</div>
<Button @type="primary" @buttonType="submit" @text="Confirm & Change Password" @icon="save" {{on "click" this.changeUserPassword}} />
</form>
+ {{else}}
+ <form id="validate-password-form" aria-label="validate-password" {{on "submit" this.validatePassword}}>
+ <legend class="mb-3">Validate Current Password</legend>
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
+ <InputGroup @name="Password" @type="password" @value={{this.password}} />
+ <InputGroup @name="Confirm Password" @type="password" @value={{this.confirmPassword}} />
+ </div>
+ <Button @type="primary" @buttonType="submit" @text="Continue" @icon="check" {{on "click" this.validatePassword}} />
+ </form>
{{/if}}
</ContentPanel>
diff --git a/console/app/templates/console/admin/two-fa-settings.hbs b/console/app/templates/console/admin/two-fa-settings.hbs
index 9170354a..27b40816 100644
--- a/console/app/templates/console/admin/two-fa-settings.hbs
+++ b/console/app/templates/console/admin/two-fa-settings.hbs
@@ -8,7 +8,15 @@
<div class="max-w-3xl my-10 mx-auto space-y-4">
<ContentPanel @title="2FA Config" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
{{#if this.loadSystemTwoFaConfig.isIdle}}
- <TwoFaSettings @showEnforceOption={{true}} @twoFaMethods={{this.methods}} @twoFaSettings={{this.twoFaSettings}} @onTwoFaToggled={{this.onTwoFaToggled}} @onTwoFaEnforcedToggled={{this.onTwoFaEnforcedToggled}} @onTwoFaMethodSelected={{this.onTwoFaMethodSelected}} />
+ <TwoFaSettings
+ @showEnforceOption={{true}}
+ @twoFaMethods={{this.methods}}
+ @twoFaSettings={{this.twoFaSettings}}
+ @onTwoFaToggled={{this.onTwoFaToggled}}
+ @onTwoFaMethodSelected={{this.onTwoFaMethodSelected}}
+ @onTwoFaEnforcedToggled={{this.onTwoFaEnforceToggled}}
+ @isLoading={{this.isLoading}}
+ />
{{else}}
<div class="flex items-center justify-center p-4">
<Spinner @loadingMessage="Loading 2FA Config..." @wrapperClass="flex flex-row" @iconClass="mr-2" />
diff --git a/console/app/templates/console/home.hbs b/console/app/templates/console/home.hbs
index 8d3a72fe..30975948 100644
--- a/console/app/templates/console/home.hbs
+++ b/console/app/templates/console/home.hbs
@@ -1,6 +1,7 @@
{{page-title "Dashboard"}}
<Layout::Section::Body class="overflow-y-scroll h-full pt-6">
<div class="console-home-container mx-auto h-screen space-y-4" {{increase-height-by 300}}>
+ <TwoFaEnforcementAlert />
<div class="grid grid-cols-1 md:grid-cols-12 gap-4">
<GithubCard class="lg:col-span-4" />
<FleetbaseBlog class="lg:col-span-8" />
diff --git a/console/app/templates/console/settings.hbs b/console/app/templates/console/settings.hbs
index aba75156..f91e0a6d 100644
--- a/console/app/templates/console/settings.hbs
+++ b/console/app/templates/console/settings.hbs
@@ -2,7 +2,7 @@
<EmberWormhole @to="sidebar-menu-items">
<Layout::Sidebar::Panel @open={{true}} @title="Settings">
<Layout::Sidebar::Item @route="console.settings.index" @icon="cog">Organization</Layout::Sidebar::Item>
- <Layout::Sidebar::Item @route="console.settings.auth" @icon="key">Auth</Layout::Sidebar::Item>
+ <Layout::Sidebar::Item @route="console.settings.two-fa" @icon="shield">Two Factor</Layout::Sidebar::Item>
{{#each this.universe.settingsMenuItems as |menuItem|}}
<Layout::Sidebar::Item
@onClick={{fn this.universe.transitionMenuItem "console.settings.virtual" menuItem}}
diff --git a/console/app/templates/console/settings/auth.hbs b/console/app/templates/console/settings/auth.hbs
index ef63e203..e69de29b 100644
--- a/console/app/templates/console/settings/auth.hbs
+++ b/console/app/templates/console/settings/auth.hbs
@@ -1,34 +0,0 @@
-{{page-title "Organization Auth"}}
-<Layout::Section::Header @title="Organization Auth" />
-
-<Layout::Section::Body class="overflow-y-scroll h-full">
- <div class="container mx-auto h-screen" {{increase-height-by 500}}>
- <div class="max-w-3xl my-10 mx-auto space-y-6">
-
- <ContentPanel @title="Enforce 2FA Settings For All Users" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
- <div class="mb-3">
- {{#if this.loadCompanyTwoFaSettings.isIdle}}
- <TwoFaSettings
- @twoFaMethods={{this.methods}}
- @twoFaSettings={{this.twoFaSettings}}
- @onTwoFaToggled={{this.onTwoFaToggled}}
- @onTwoFaMethodSelected={{this.onTwoFaMethodSelected}}
- />
- {{else}}
- <div class="flex items-center justify-center p-4">
- <Spinner @loadingMessage="Loading User 2FA Settings..." @wrapperClass="flex flex-row" @iconClass="mr-2" />
- </div>
- {{/if}}
- </div>
- <Button
- @type="primary"
- @buttonType="submit"
- @text="Save 2FA Settings"
- @icon="save"
- @onClick={{this.enforceTwoFaForCompanyUsersAction}}
- @isLoading={{this.enforceTwoFaForCompanyUsersAction.isRunning}}
- />
- </ContentPanel>
- </div>
- </div>
-</Layout::Section::Body>
\ No newline at end of file
diff --git a/console/app/templates/console/settings/two-fa.hbs b/console/app/templates/console/settings/two-fa.hbs
new file mode 100644
index 00000000..1e91a881
--- /dev/null
+++ b/console/app/templates/console/settings/two-fa.hbs
@@ -0,0 +1,35 @@
+{{page-title "TwoFa"}}
+<Layout::Section::Header @title="2FA" />
+
+<Layout::Section::Body class="overflow-y-scroll h-full">
+ <div class="container mx-auto h-screen" {{increase-height-by 500}}>
+ <div class="max-w-3xl my-10 mx-auto space-y-6">
+ <ContentPanel @title="2FA Settings" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
+ <div class="mb-3">
+ {{#if this.loadCompanyTwoFaSettings.isIdle}}
+ <TwoFaSettings
+ @showEnforceOption={{true}}
+ @twoFaMethods={{this.methods}}
+ @twoFaSettings={{this.twoFaSettings}}
+ @onTwoFaToggled={{this.onTwoFaToggled}}
+ @onTwoFaMethodSelected={{this.onTwoFaMethodSelected}}
+ @onTwoFaEnforcedToggled={{this.onTwoFaEnforceToggled}}
+ />
+ {{else}}
+ <div class="flex items-center justify-center p-4">
+ <Spinner @loadingMessage="Loading User 2FA Settings..." @wrapperClass="flex flex-row" @iconClass="mr-2" />
+ </div>
+ {{/if}}
+ </div>
+ <Button
+ @type="primary"
+ @buttonType="submit"
+ @text="Save 2FA Settings"
+ @icon="save"
+ @onClick={{this.saveTwoFactor}}
+ @isLoading={{this.enforceTwoFaForCompanyUsers.isRunning}}
+ />
+ </ContentPanel>
+ </div>
+ </div>
+</Layout::Section::Body>
\ No newline at end of file
diff --git a/console/app/utils/get-two-fa-methods.js b/console/app/utils/get-two-fa-methods.js
index fc26f0b8..08934a77 100644
--- a/console/app/utils/get-two-fa-methods.js
+++ b/console/app/utils/get-two-fa-methods.js
@@ -1,12 +1,12 @@
export default function getTwoFaMethods() {
- return [
- // {
- // key: 'authenticator_app',
- // name: 'Authenticator App',
- // description: 'Get codes from an app like Authy, 1Password, Microsoft Authenticator, or Google Authenticator',
- // recommended: true,
- // },
- { key: 'sms', name: 'SMS', description: 'Receive a unique code via SMS' },
- { key: 'email', name: 'Email', description: 'Receive a unique code via Email' },
- ];
+ return [
+ // {
+ // key: 'authenticator_app',
+ // name: 'Authenticator App',
+ // description: 'Get codes from an app like Authy, 1Password, Microsoft Authenticator, or Google Authenticator',
+ // recommended: true,
+ // },
+ { key: 'sms', name: 'SMS', description: 'Receive a unique code via SMS' },
+ { key: 'email', name: 'Email', description: 'Receive a unique code via Email' },
+ ];
}