diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js
index f7968a0357..f3fe77f4ca 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js
@@ -216,7 +216,7 @@ module.controller('UserConsentsCtrl', function($scope, realm, user, userConsents
});
-module.controller('UserListCtrl', function($scope, realm, User, UserImpersonation) {
+module.controller('UserListCtrl', function($scope, realm, User, UserImpersonation, BruteForce, Notifications) {
$scope.realm = realm;
$scope.page = 0;
@@ -236,6 +236,13 @@ module.controller('UserListCtrl', function($scope, realm, User, UserImpersonatio
});
};
+ $scope.unlockUsers = function() {
+ BruteForce.delete({realm: realm.realm}, function(data) {
+ Notifications.success("Any temporarily locked users are now unlocked.");
+ });
+ }
+
+
$scope.firstPage = function() {
$scope.query.first = 0;
$scope.searchQuery();
@@ -282,7 +289,7 @@ module.controller('UserTabCtrl', function($scope, $location, Dialog, Notificatio
};
});
-module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, UserImpersonation, RequiredActions, $location, Dialog, Notifications) {
+module.controller('UserDetailCtrl', function($scope, realm, user, BruteForceUser, User, UserFederationInstances, UserImpersonation, RequiredActions, $location, Dialog, Notifications) {
$scope.realm = realm;
$scope.create = !user.id;
$scope.editUsername = $scope.create || $scope.realm.editUsernameAllowed;
@@ -315,6 +322,23 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFede
} else {
console.log("federationLink is null");
}
+ console.log('realm brute force? ' + realm.bruteForceProtected)
+ $scope.temporarilyDisabled = false;
+ var isDisabled = function () {
+ BruteForceUser.get({realm: realm.realm, username: user.username}, function(data) {
+ console.log('here in isDisabled ' + data.disabled);
+ $scope.temporarilyDisabled = data.disabled;
+ });
+ };
+
+ console.log("check if disabled");
+ isDisabled();
+
+ $scope.unlockUser = function() {
+ BruteForceUser.delete({realm: realm.realm, username: user.username}, function(data) {
+ isDisabled();
+ });
+ }
}
$scope.changed = false; // $scope.create;
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js
index 5e9fefda63..1d6a6be925 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js
@@ -186,6 +186,20 @@ module.factory('RealmAdminEvents', function($resource) {
});
});
+module.factory('BruteForce', function($resource) {
+ return $resource(authUrl + '/admin/realms/:realm/attack-detection/brute-force/usernames', {
+ realm : '@realm'
+ });
+});
+
+module.factory('BruteForceUser', function($resource) {
+ return $resource(authUrl + '/admin/realms/:realm/attack-detection/brute-force/usernames/:username', {
+ realm : '@realm',
+ username : '@username'
+ });
+});
+
+
module.factory('RequiredActions', function($resource) {
return $resource(authUrl + '/admin/realms/:id/authentication/required-actions/:alias', {
realm : '@realm',
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html
index e9da897795..5b4ae7f745 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html
@@ -66,6 +66,16 @@