From 7c578d14d9d74524f76277025a666c04dc3645e0 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 10 Oct 2024 00:33:35 +0800 Subject: [PATCH] added ability to manually verify user from IAM users mgmt --- addon/controllers/users/index.js | 32 +++++++++++++++++++++++++++++++- package.json | 6 +++--- translations/en-us.yaml | 4 ++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/addon/controllers/users/index.js b/addon/controllers/users/index.js index 05b456e..e694dca 100644 --- a/addon/controllers/users/index.js +++ b/addon/controllers/users/index.js @@ -178,6 +178,13 @@ export default class UsersIndexController extends Controller { permission: 'iam activate user', isVisible: (user) => user.get('session_status') === 'inactive' || (this.currentUser.user.is_admin && user.get('session_status') === 'pending'), }, + { + label: this.intl.t('iam.users.index.verify-user'), + fn: this.verifyUser, + className: 'text-danger', + permission: 'iam verify user', + isVisible: (user) => !user.get('email_verified_at'), + }, { label: this.intl.t('iam.users.index.delete-user'), fn: this.deleteUser, @@ -402,7 +409,7 @@ export default class UsersIndexController extends Controller { } /** - * Deactivates a user + * Activate a user * * @void */ @@ -424,6 +431,29 @@ export default class UsersIndexController extends Controller { }); } + /** + * Verify a user + * + * @void + */ + @action verifyUser(user) { + this.modalsManager.confirm({ + title: this.intl.t('iam.users.index.verify-user-title', { userName: user.get('name') }), + body: this.intl.t('iam.users.index.verify-user-manually-prompt'), + confirm: async (modal) => { + modal.startLoading(); + try { + await user.verify(); + this.notifications.success(this.intl.t('iam.users.index.user-verified-success-message', { userName: user.get('name') })); + this.hostRouter.refresh(); + } catch (error) { + this.notifications.serverError(error); + modal.stopLoading(); + } + }, + }); + } + /** * Resends invite for a user to join. * diff --git a/package.json b/package.json index bff9dda..0d058f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/iam-engine", - "version": "0.1.1", + "version": "0.1.2", "description": "Fleetbase IAM extension provides identity and access management module for managing users, permissions and policies.", "fleetbase": { "route": "iam" @@ -41,8 +41,8 @@ "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish" }, "dependencies": { - "@fleetbase/ember-core": "^0.2.19", - "@fleetbase/ember-ui": "^0.2.32", + "@fleetbase/ember-core": "^0.2.21", + "@fleetbase/ember-ui": "^0.2.34", "@babel/core": "^7.23.2", "ember-cli-babel": "^8.2.0", "ember-cli-htmlbars": "^6.3.0", diff --git a/translations/en-us.yaml b/translations/en-us.yaml index fa1f687..2e4d979 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -129,6 +129,9 @@ iam: deactivate-user-success-message: User {userName} deactivated. re-activate-user-title: Re-activate {userName} user's account re-activate-user-success-message: User {userName} activated. + verify-user-title: Manually Verify user {userName} account + verify-user-manually-prompt: By clicking confirm this action will manually verify the users email address. Are you sure you want to bypass verification for this user? + user-verified-success-message: User {userName} verified. delete-users: Delete Users last-login: Last Login created-at: Created At @@ -140,6 +143,7 @@ iam: deactivate-user: Deactivate user... activate-user: Activate user... delete-user: Delete user... + verify-user: Verify user... new-user: New User user-invited-join-your-organization-success: User has been invited to join your organization. edit-user-title: Edit User