Sfoglia il codice sorgente

AMBARI-3902. Admin page->users: password confirmation while adding new user should be computed property (Denys Buzhor via alexantonenko)

Alex Antonenko 11 anni fa
parent
commit
2f06f26c06
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12 0
      ambari-web/app/views/main/admin/user/create.js

+ 12 - 0
ambari-web/app/views/main/admin/user/create.js

@@ -21,6 +21,8 @@ var App = require('app');
 App.MainAdminUserCreateView = Em.View.extend({
   templateName: require('templates/main/admin/user/create'),
   userId: false,
+  isPasswordDirty: false,
+
   create: function(event){
     var parent_controller=this.get("controller").controllers.mainAdminUserController;
     var form = this.get("userForm");
@@ -76,6 +78,16 @@ App.MainAdminUserCreateView = Em.View.extend({
     }
   },
 
+  passwordValidation: function() {
+    var passwordValue = this.get('userForm').getField('password').get('value');
+    if (passwordValue && !this.get('isPasswordDirty')) {
+      this.set('isPasswordDirty', true);
+    }
+    if (this.get('isPasswordDirty')) {
+      this.get('userForm').isValid();
+    }
+  }.observes('userForm.fields.@each.value'),
+
   didInsertElement: function(){
     this.get('userForm').propertyDidChange('object');
   }