keycloak-aplcache

KEYCLOAK-73

11/23/2013 11:38:34 AM

Details

diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
index f021923..d97aed7 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
@@ -487,6 +487,46 @@ module.directive('kcEnter', function() {
     };
 });
 
+module.directive('kcSave', function ($compile, Notifications) {
+    return {
+        restrict: 'A',
+        link: function ($scope, elem, attr, ctrl) {
+            elem.bind('click', function() {
+                $scope.$apply(function() {
+                    var form = elem.closest('form');
+                    if (form && form.attr('name')) {
+                        if ($scope[form.attr('name')].$valid) {
+                            form.find('.ng-valid').removeClass('error');
+                            $scope['save']();
+                        } else {
+                            Notifications.error("Missing or invalid field")
+                            form.find('.ng-invalid').addClass('error');
+                            form.find('.ng-valid').removeClass('error');
+                        }
+                    }
+                });
+            })
+        }
+    }
+});
+
+module.directive('kcReset', function ($compile, Notifications) {
+    return {
+        restrict: 'A',
+        link: function ($scope, elem, attr, ctrl) {
+            elem.bind('click', function() {
+                $scope.$apply(function() {
+                    var form = elem.closest('form');
+                    if (form && form.attr('name')) {
+                        form.find('.ng-valid').removeClass('error');
+                        form.find('.ng-invalid').removeClass('error');
+                        $scope['reset']();
+                    }
+                })
+            })
+        }
+    }
+});
 
 module.filter('remove', function() {
     return function(input, remove, attribute) {
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js
index b4d9ee6..9d93d6f 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/applications.js
@@ -131,7 +131,6 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
                 var id = l.substring(l.lastIndexOf("/") + 1);
                 $location.url("/realms/" + realm.id + "/applications/" + application.id + "/roles/" + id);
                 Notifications.success("The role has been created.");
-
             });
         } else {
             ApplicationRole.update({
@@ -149,7 +148,6 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati
     $scope.reset = function() {
         $scope.role = angular.copy(role);
         $scope.changed = false;
-        $scope.roleForm.showErrors = false;
     };
 
     $scope.cancel = function() {
@@ -222,38 +220,31 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, 
     }
 
     $scope.save = function() {
-        if ($scope.applicationForm.$valid) {
-
-            if ($scope.create) {
-                Application.save({
-                    realm: realm.id
-                }, $scope.application, function (data, headers) {
-                    $scope.changed = false;
-                    var l = headers().location;
-                    var id = l.substring(l.lastIndexOf("/") + 1);
-                    $location.url("/realms/" + realm.id + "/applications/" + id);
-                    Notifications.success("The application has been created.");
-                });
-            } else {
-                Application.update({
-                    realm : realm.id,
-                    id : application.id
-                }, $scope.application, function() {
-                    $scope.changed = false;
-                    application = angular.copy($scope.application);
-                    Notifications.success("Your changes have been saved to the application.");
-                });
-            }
-
+        if ($scope.create) {
+            Application.save({
+                realm: realm.id
+            }, $scope.application, function (data, headers) {
+                $scope.changed = false;
+                var l = headers().location;
+                var id = l.substring(l.lastIndexOf("/") + 1);
+                $location.url("/realms/" + realm.id + "/applications/" + id);
+                Notifications.success("The application has been created.");
+            });
         } else {
-            $scope.applicationForm.showErrors = true;
+            Application.update({
+                realm : realm.id,
+                id : application.id
+            }, $scope.application, function() {
+                $scope.changed = false;
+                application = angular.copy($scope.application);
+                Notifications.success("Your changes have been saved to the application.");
+            });
         }
     };
 
     $scope.reset = function() {
         $scope.application = angular.copy(application);
         $scope.changed = false;
-        $scope.applicationForm.showErrors = false;
     };
 
     $scope.cancel = function() {
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
index 38192c6..9271bfb 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
@@ -90,57 +90,52 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
     }, true);
 
     $scope.save = function() {
-        if ($scope.realmForm.$valid) {
-            var realmCopy = angular.copy($scope.realm);
-            realmCopy.sslNotRequired = !realmCopy.requireSsl;
-            delete realmCopy["requireSsl"];
-            if ($scope.createRealm) {
-                Realm.save(realmCopy, function(data, headers) {
-                    console.log('creating new realm');
-                    var l = headers().location;
-                    var id = l.substring(l.lastIndexOf("/") + 1);
-                    var data = Realm.query(function() {
-                        Current.realms = data;
-                        for (var i = 0; i < Current.realms.length; i++) {
-                            if (Current.realms[i].id == id) {
-                                Current.realm = Current.realms[i];
-                            }
-                        }
-                        $location.url("/realms/" + id);
-                        Notifications.success("The realm has been created.");
-                        $scope.social = $scope.realm.social;
-                        $scope.registrationAllowed = $scope.realm.registrationAllowed;
-                    });
-                });
-            } else {
-                console.log('updating realm...');
-                $scope.changed = false;
-                Realm.update(realmCopy, function() {
-                    var id = realmCopy.id;
-                    var data = Realm.query(function() {
-                        Current.realms = data;
-                        for (var i = 0; i < Current.realms.length; i++) {
-                            if (Current.realms[i].id == id) {
-                                Current.realm = Current.realms[i];
-                                oldCopy = angular.copy($scope.realm);
-                            }
+        var realmCopy = angular.copy($scope.realm);
+        realmCopy.sslNotRequired = !realmCopy.requireSsl;
+        delete realmCopy["requireSsl"];
+        if ($scope.createRealm) {
+            Realm.save(realmCopy, function(data, headers) {
+                console.log('creating new realm');
+                var l = headers().location;
+                var id = l.substring(l.lastIndexOf("/") + 1);
+                var data = Realm.query(function() {
+                    Current.realms = data;
+                    for (var i = 0; i < Current.realms.length; i++) {
+                        if (Current.realms[i].id == id) {
+                            Current.realm = Current.realms[i];
                         }
-                    });
+                    }
                     $location.url("/realms/" + id);
-                    Notifications.success("Your changes have been saved to the realm.");
+                    Notifications.success("The realm has been created.");
                     $scope.social = $scope.realm.social;
                     $scope.registrationAllowed = $scope.realm.registrationAllowed;
                 });
-            }
+            });
         } else {
-            $scope.realmForm.showErrors = true;
+            console.log('updating realm...');
+            $scope.changed = false;
+            Realm.update(realmCopy, function () {
+                var id = realmCopy.id;
+                var data = Realm.query(function () {
+                    Current.realms = data;
+                    for (var i = 0; i < Current.realms.length; i++) {
+                        if (Current.realms[i].id == id) {
+                            Current.realm = Current.realms[i];
+                            oldCopy = angular.copy($scope.realm);
+                        }
+                    }
+                });
+                $location.url("/realms/" + id);
+                Notifications.success("Your changes have been saved to the realm.");
+                $scope.social = $scope.realm.social;
+                $scope.registrationAllowed = $scope.realm.registrationAllowed;
+            });
         }
     };
 
     $scope.reset = function() {
         $scope.realm = angular.copy(oldCopy);
         $scope.changed = false;
-        $scope.realmForm.showErrors = false;
     };
 
     $scope.cancel = function() {
@@ -186,22 +181,17 @@ module.controller('RealmRequiredCredentialsCtrl', function($scope, Realm, realm,
     }, true);
 
     $scope.save = function() {
-        if ($scope.realmForm.$valid) {
-            var realmCopy = angular.copy($scope.realm);
-            $scope.changed = false;
-            Realm.update(realmCopy, function () {
-                $location.url("/realms/" + realm.id + "/required-credentials");
-                Notifications.success("Your changes have been saved to the realm.");
-            });
-        } else {
-            $scope.realmForm.showErrors = true;
-        }
+        var realmCopy = angular.copy($scope.realm);
+        $scope.changed = false;
+        Realm.update(realmCopy, function () {
+            $location.url("/realms/" + realm.id + "/required-credentials");
+            Notifications.success("Your changes have been saved to the realm.");
+        });
     };
 
     $scope.reset = function() {
         $scope.realm = angular.copy(oldCopy);
         $scope.changed = false;
-        $scope.realmForm.showErrors = false;
     };
 });
 
@@ -450,20 +440,14 @@ module.controller('RealmSocialCtrl', function($scope, realm, Realm, $location, N
     }, true);
 
     $scope.save = function() {
-        if ($scope.realmForm.$valid) {
-            var realmCopy = angular.copy($scope.realm);
-            realmCopy.social = true;
-            $scope.changed = false;
-            Realm.update(realmCopy, function () {
-                $location.url("/realms/" + realm.id + "/social-settings");
-                Notifications.success("Saved changes to realm");
-                oldCopy = realmCopy;
-            });
-        } else {
-            $scope.realmForm.showErrors = true;
-            Notifications.error("Some required fields are missing values.");
-            $scope.postSaveProviders = $scope.configuredProviders.slice(0);
-        }
+        var realmCopy = angular.copy($scope.realm);
+        realmCopy.social = true;
+        $scope.changed = false;
+        Realm.update(realmCopy, function () {
+            $location.url("/realms/" + realm.id + "/social-settings");
+            Notifications.success("Saved changes to realm");
+            oldCopy = realmCopy;
+        });
     };
 
     $scope.reset = function() {
@@ -505,46 +489,41 @@ module.controller('RealmTokenDetailCtrl', function($scope, Realm, realm, $http, 
     }, true);
 
     $scope.save = function() {
-        if ($scope.realmForm.$valid) {
-            var realmCopy = angular.copy($scope.realm);
-            delete realmCopy["tokenLifespanUnit"];
-            delete realmCopy["accessCodeLifespanUnit"];
-            delete realmCopy["accessCodeLifespanUserActionUnit"];
-            if ($scope.realm.tokenLifespanUnit == 'Minutes') {
-                realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60;
-            } else if ($scope.realm.tokenLifespanUnit == 'Hours') {
-                realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60;
-            } else if ($scope.realm.tokenLifespanUnit == 'Days') {
-                realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60 * 24;
-            }
-            if ($scope.realm.accessCodeLifespanUnit == 'Minutes') {
-                realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60;
-            } else if ($scope.realm.accessCodeLifespanUnit == 'Hours') {
-                realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60;
-            } else if ($scope.realm.accessCodeLifespanUnit == 'Days') {
-                realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60 * 24;
-            }
-            if ($scope.realm.accessCodeLifespanUserActionUnit == 'Minutes') {
-                realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60;
-            } else if ($scope.realm.accessCodeLifespanUserActionUnit == 'Hours') {
-                realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60 * 60;
-            } else if ($scope.realm.accessCodeLifespanUserActionUnit == 'Days') {
-                realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60 * 60 * 24;
-            }
-            $scope.changed = false;
-            Realm.update(realmCopy, function () {
-                $location.url("/realms/" + realm.id + "/token-settings");
-                Notifications.success("Your changes have been saved to the realm.");
-            });
-        } else {
-            $scope.realmForm.showErrors = true;
+        var realmCopy = angular.copy($scope.realm);
+        delete realmCopy["tokenLifespanUnit"];
+        delete realmCopy["accessCodeLifespanUnit"];
+        delete realmCopy["accessCodeLifespanUserActionUnit"];
+        if ($scope.realm.tokenLifespanUnit == 'Minutes') {
+            realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60;
+        } else if ($scope.realm.tokenLifespanUnit == 'Hours') {
+            realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60;
+        } else if ($scope.realm.tokenLifespanUnit == 'Days') {
+            realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60 * 24;
+        }
+        if ($scope.realm.accessCodeLifespanUnit == 'Minutes') {
+            realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60;
+        } else if ($scope.realm.accessCodeLifespanUnit == 'Hours') {
+            realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60;
+        } else if ($scope.realm.accessCodeLifespanUnit == 'Days') {
+            realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60 * 24;
         }
+        if ($scope.realm.accessCodeLifespanUserActionUnit == 'Minutes') {
+            realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60;
+        } else if ($scope.realm.accessCodeLifespanUserActionUnit == 'Hours') {
+            realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60 * 60;
+        } else if ($scope.realm.accessCodeLifespanUserActionUnit == 'Days') {
+            realmCopy.accessCodeLifespanUserAction = $scope.realm.accessCodeLifespanUserAction * 60 * 60 * 24;
+        }
+        $scope.changed = false;
+        Realm.update(realmCopy, function () {
+            $location.url("/realms/" + realm.id + "/token-settings");
+            Notifications.success("Your changes have been saved to the realm.");
+        });
     };
 
     $scope.reset = function() {
         $scope.realm = angular.copy(oldCopy);
         $scope.changed = false;
-        $scope.realmForm.showErrors = false;
     };
 });
 
@@ -606,7 +585,6 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $locatio
                 var id = l.substring(l.lastIndexOf("/") + 1);
                 $location.url("/realms/" + realm.id + "/roles/" + id);
                 Notifications.success("The role has been created.");
-
             });
         } else {
             Role.update({
@@ -623,7 +601,6 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $locatio
     $scope.reset = function() {
         $scope.role = angular.copy(role);
         $scope.changed = false;
-        $scope.roleForm.showErrors = false;
     };
 
     $scope.cancel = function() {
@@ -659,21 +636,16 @@ module.controller('RealmSMTPSettingsCtrl', function($scope, Current, Realm, real
     }, true);
 
     $scope.save = function() {
-        if ($scope.realmForm.$valid) {
-            var realmCopy = angular.copy($scope.realm);
-            $scope.changed = false;
-            Realm.update(realmCopy, function () {
-                $location.url("/realms/" + realm.id + "/smtp-settings");
-                Notifications.success("Your changes have been saved to the realm.");
-            });
-        } else {
-            $scope.realmForm.showErrors = true;
-        }
+        var realmCopy = angular.copy($scope.realm);
+        $scope.changed = false;
+        Realm.update(realmCopy, function () {
+            $location.url("/realms/" + realm.id + "/smtp-settings");
+            Notifications.success("Your changes have been saved to the realm.");
+        });
     };
 
     $scope.reset = function() {
         $scope.realm = angular.copy(oldCopy);
         $scope.changed = false;
-        $scope.realmForm.showErrors = false;
     };
 });
\ No newline at end of file
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/users.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/users.js
index e5363ea..e818b64 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/users.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/users.js
@@ -195,7 +195,6 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, $locatio
                 user = angular.copy($scope.user);
                 Notifications.success("Your changes have been saved to the user.");
             });
-
         }
     };
 
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html
index e766d57..5cdaee9 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-detail.html
@@ -94,16 +94,16 @@
                         </div>
                     </fieldset>
                     <div class="form-actions" data-ng-show="create">
-                        <button type="submit" data-ng-click="save()" data-ng-show="changed" class="primary">Save
+                        <button type="submit" kc-save data-ng-show="changed" class="primary">Save
                         </button>
                         <button type="submit" data-ng-click="cancel()">Cancel
                         </button>
                     </div>
 
                     <div class="form-actions" data-ng-show="!create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                         <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                             Delete
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html
index d7ccf00..a147697 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-role-detail.html
@@ -54,7 +54,7 @@
                         </div>
                     </fieldset>
                     <div class="form-actions" data-ng-show="create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
                         <button type="submit" data-ng-click="cancel()" data-ng-click="cancel()"
                                 data-ng-show="changed">Cancel
@@ -62,9 +62,9 @@
                     </div>
 
                     <div class="form-actions" data-ng-show="!create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                         <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                             Delete
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-credentials.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-credentials.html
index e2b2104..3b3c940 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-credentials.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-credentials.html
@@ -46,9 +46,9 @@
                         </div>
                     </fieldset>
                    <div class="form-actions">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                     </div>
 
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html
index ea45bbe..673d570 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html
@@ -72,16 +72,16 @@
                     </fieldset>
 
                     <div class="form-actions" data-ng-show="createRealm">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
                         <button type="submit" data-ng-click="cancel()">Cancel
                         </button>
                     </div>
 
                     <div class="form-actions" data-ng-show="!createRealm">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                         <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                             Delete
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-smtp.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-smtp.html
index d278a49..2ba7ad8 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-smtp.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-smtp.html
@@ -96,9 +96,9 @@
                     </fieldset>
 -->
                    <div class="form-actions">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" data-kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" data-kc-reset data-ng-show="changed">Clear changes
                         </button>
                     </div>
 
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-social.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-social.html
index 74cce36..bbbbfd0 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-social.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-social.html
@@ -73,10 +73,10 @@
                         </div>
                     </fieldset>
                     <div class="form-actions">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                             changes
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                     </div>
                 </form>
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-tokens.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-tokens.html
index 5585318..4921101 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-tokens.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-tokens.html
@@ -67,9 +67,9 @@
                         </div>
                      </fieldset>
                     <div class="form-actions">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                     </div>
                </form>
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-detail.html
index e9ee0c0..8e1837c 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-detail.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/role-detail.html
@@ -42,12 +42,12 @@
                             <label for="description">Description </label>
 
                             <div class="controls">
-                                <textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description" required></textarea>
+                                <textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description"></textarea>
                             </div>
                         </div>
                     </fieldset>
                     <div class="form-actions" data-ng-show="create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
                         <button type="submit" data-ng-click="cancel()" data-ng-click="cancel()"
                                 data-ng-show="changed">Cancel
@@ -55,9 +55,9 @@
                     </div>
 
                     <div class="form-actions" data-ng-show="!create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                         <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                             Delete
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/user-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/user-detail.html
index 5505366..6de7582 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/user-detail.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/user-detail.html
@@ -31,7 +31,7 @@
                 </ol>
                 <h2 class="pull-left" data-ng-hide="create"><span>{{user.username}}'s</span> Attributes</h2>
                 
-                <form name="applicationForm" novalidate>
+                <form name="userForm" novalidate>
                     <fieldset class="border-top">
                         <div class="form-group">
                             <label for="username">Username <span class="required" data-ng-show="create">*</span></label>
@@ -87,16 +87,16 @@
                         </div>
                     </fieldset>
                     <div class="form-actions" data-ng-show="create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
                         <button type="submit" data-ng-click="cancel()">Cancel
                         </button>
                     </div>
 
                     <div class="form-actions" data-ng-show="!create">
-                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
+                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                         </button>
-                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
+                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                         </button>
                         <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                             Delete