This is an automated email from the ASF dual-hosted git repository. harikrishna pushed a commit to branch 2FA in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 025744d7b045453f6e18cf68d155a66739e71e0f Author: Harikrishna Patnala <[email protected]> AuthorDate: Tue Nov 8 15:20:28 2022 +0530 Added success messages for UI operations --- .../com/cloud/api/auth/SetupUserTwoFactorAuthenticationCmd.java | 2 +- server/src/main/java/com/cloud/user/AccountManagerImpl.java | 2 +- ui/public/locales/en.json | 1 + ui/src/config/section/user.js | 5 ++++- ui/src/views/dashboard/TwoFa.vue | 6 ++++++ ui/src/views/iam/RegisterTwoFactorAuth.vue | 6 +++++- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/cloud/api/auth/SetupUserTwoFactorAuthenticationCmd.java b/server/src/main/java/com/cloud/api/auth/SetupUserTwoFactorAuthenticationCmd.java index 055d84c816b..77b51bf8153 100644 --- a/server/src/main/java/com/cloud/api/auth/SetupUserTwoFactorAuthenticationCmd.java +++ b/server/src/main/java/com/cloud/api/auth/SetupUserTwoFactorAuthenticationCmd.java @@ -51,7 +51,7 @@ public class SetupUserTwoFactorAuthenticationCmd extends BaseCmd { @Parameter(name = ApiConstants.ENABLE, type = CommandType.BOOLEAN, description = "Enabled by default, provide false to disable 2FA") private Boolean enable; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, entityType = UserResponse.class, description = "optional: the id of the user for which 2FA has to be disabled") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "optional: the id of the user for which 2FA has to be disabled") private Long userId; ///////////////////////////////////////////////////// diff --git a/server/src/main/java/com/cloud/user/AccountManagerImpl.java b/server/src/main/java/com/cloud/user/AccountManagerImpl.java index 980d77628e4..36d7272d87d 100644 --- a/server/src/main/java/com/cloud/user/AccountManagerImpl.java +++ b/server/src/main/java/com/cloud/user/AccountManagerImpl.java @@ -3231,7 +3231,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M if (userVO == null) { throw new InvalidParameterValueException("Unable to find user= " + userVO.getUsername() + " in domain id = " + caller.getDomainId()); } - owner = _accountService.getActiveAccountById(userId); + owner = _accountService.getActiveAccountById(userVO.getAccountId()); } else { userId = CallContext.current().getCallingUserId(); userVO = _userDao.findById(userId); diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index aa2ac1c9336..3031569654e 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -104,6 +104,7 @@ "label.action.edit.instance": "Edit instance", "label.action.edit.iso": "Edit ISO", "label.action.edit.zone": "Edit zone", +"label.action.enable.two.factor.authentication": "Enable Two factor authentication", "label.action.enable.account": "Enable account", "label.action.enable.cluster": "Enable cluster", "label.action.enable.maintenance.mode": "Enable maintenance mode", diff --git a/ui/src/config/section/user.js b/ui/src/config/section/user.js index cb86d395396..c7fe2a7606d 100644 --- a/ui/src/config/section/user.js +++ b/ui/src/config/section/user.js @@ -125,10 +125,13 @@ export default { dataView: true, groupAction: true, popup: true, - args: ['enable'], + args: ['enable', 'userid'], mapping: { enable: { value: (record) => { return false } + }, + userid: { + value: (record) => { return record.id } } }, show: (record, store) => { diff --git a/ui/src/views/dashboard/TwoFa.vue b/ui/src/views/dashboard/TwoFa.vue index 9487ffc33da..416c915e2e3 100644 --- a/ui/src/views/dashboard/TwoFa.vue +++ b/ui/src/views/dashboard/TwoFa.vue @@ -89,6 +89,12 @@ export default { this.$store.commit('SET_COUNT_NOTIFY', 0) this.$store.commit('SET_LOGIN_FLAG', true) this.$router.push({ path: '/dashboard' }).catch(() => {}) + + this.$message.success({ + content: `${this.$t('label.action.enable.two.factor.authentication')}`, + duration: 2 + }) + this.$emit('refresh-data') } console.log(response) }).catch(error => { diff --git a/ui/src/views/iam/RegisterTwoFactorAuth.vue b/ui/src/views/iam/RegisterTwoFactorAuth.vue index 67eab5bbefa..388e7fa3173 100644 --- a/ui/src/views/iam/RegisterTwoFactorAuth.vue +++ b/ui/src/views/iam/RegisterTwoFactorAuth.vue @@ -142,7 +142,11 @@ export default { }, submitPin () { api('validateUserTwoFactorAuthenticationCode', { '2facode': this.code }).then(response => { - console.log(response) + this.$message.success({ + content: `${this.$t('label.action.enable.two.factor.authentication')}`, + duration: 2 + }) + this.$emit('refresh-data') }).catch(error => { this.$notification.error({ message: this.$t('message.request.failed'),
