Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SER-2177] Adding 'disable 2FA' option in the user management > users #5869

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Fixes:
- [push] Fixed bug where IOS credentials get mixed up while sending messages from different apps at the same time
- [push] Fixed bug where it crashes in connection pool growth because of a type mismatch in an if condition

Features:
- [user-management] Global admins can now disable 2FA for individual users

Dependencies:
- Bump express from 4.21.1 to 4.21.2
- Bump mocha from 10.2.0 to 10.8.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,21 @@
callback(err.responseJSON.result);
});
};
countlyUserManagement.disableTwoFactorAuth = function(id, callback) {
return $.ajax({
type: "GET",
url: countlyGlobal.path + "/i/two-factor-auth",
data: {
method: "admin_disable",
uid: id
},
success: function() {
callback();
},
error: function(err) {
callback(err.responseJSON.result);
}
});
};

})((window.countlyUserManagement = window.countlyUserManagement || {}));
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
roleMap: roleMap,
showLogs: countlyGlobal.plugins.indexOf('systemlogs') > -1,
twoFactorAuth: countlyGlobal.plugins.indexOf('two-factor-auth') > -1,
tableDynamicCols: tableDynamicCols,
userManagementPersistKey: 'userManagement_table_' + countlyCommon.ACTIVE_APP_ID,
isGroupPluginEnabled: isGroupPluginEnabled
Expand Down Expand Up @@ -114,6 +115,9 @@
}
},
methods: {
is2faEnabled: function(row) {
return countlyGlobal.member.global_admin && this.twoFactorAuth && row.two_factor_auth && row.two_factor_auth.enabled;
},
handleCommand: function(command, index) {
switch (command) {
case "delete-user":
Expand Down Expand Up @@ -157,6 +161,21 @@
});
});
break;
case 'disable-2fa':
countlyUserManagement.disableTwoFactorAuth(index, function(err) {
if (err) {
CountlyHelpers.notify({
message: CV.i18n('two-factor-auth.faildisable_title'),
type: 'error'
});
return;
}
CountlyHelpers.notify({
message: CV.i18n('two-factor-auth.disable_title'),
type: 'success'
});
});
break;
}
},
handleSubmitFilter: function(newFilter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ <h4>{{i18n('management-users.view-title')}}</h4>
<el-dropdown-item v-if="showLogs" command="show-logs" :data-test-id="'datatable-users-more-button-view-logs-select-' + rowScope.$index">{{ i18n('management-users.view-user-logs') }}</el-dropdown-item>
<el-dropdown-item command="reset-logins" :data-test-id="'datatable-users-more-button-reset-logins-select-' + rowScope.$index">{{ i18n('management-users.reset-failed-logins') }}</el-dropdown-item>
<el-dropdown-item command="delete-user" :data-test-id="'datatable-users-more-button-delete-user-select-' + rowScope.$index">{{ i18n('management-users.delete-user') }}</el-dropdown-item>
<el-dropdown-item v-if="is2faEnabled(rowScope.row)" command="disable-2fa" :data-test-id="'datatable-users-more-button-disable-2fa-select-' + rowScope.$index">{{ i18n('management-users.disable-2fa-user') }}</el-dropdown-item>
</cly-more-options>
</template>
</el-table-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ management-users.no-role = No role
management-users.create-user = Create User
management-users.delete-user = Delete User
management-users.edit = Click to edit
management-users.disable-2fa-user = Disable 2FA
management-users.all-roles = All roles
management-users.not-logged-in-yet = Not logged in yet
management-users.close = Click to close
Expand Down
Loading