Skip to content

Commit

Permalink
added ability to manually verify user from IAM users mgmt
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Oct 9, 2024
1 parent 23dec1c commit 7c578d1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
32 changes: 31 additions & 1 deletion addon/controllers/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -402,7 +409,7 @@ export default class UsersIndexController extends Controller {
}

/**
* Deactivates a user
* Activate a user
*
* @void
*/
Expand All @@ -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.
*
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7c578d1

Please sign in to comment.