1function UserMetadataValidator() { 2 this.isValidUsername = function(value) { 3 if(value.match(/^[\w-_\.@]+$/)) { 4 return true; 5 } 6 return false; 7 }; 8 9 this.isValidPassword = function(value) { 10 if(value) { 11 return true; 12 } 13 return KGISvalueFetching.metaData.has('id'); 14 }; 15 16 this.isValidSet = function(inputSet){ 17 var failed = new Array(); 18 if(!this.isValidUsername(inputSet.username)) { 19 failed.push('username'); 20 } 21 if($('#old_password').length > 0) { 22 if(!this.isValidPassword(inputSet.old_password) || !inputSet.old_password) { 23 failed.push('old_password'); 24 } 25 } 26 if(!this.isValidPassword(inputSet.password)) { 27 failed.push('password'); 28 } 29 if(!this.isValidOptionalEmail(inputSet.email)) { 30 failed.push('email'); 31 } 32 return failed; 33 }; 34} 35UserMetadataValidator.prototype = new KGISValidator( ); 36 37var User = Backbone.Model.extend({ 38 urlRoot: KGISConfig.apiRoot + '/admin/chpwd/', 39 40 initialize: function(){ 41 this.on("change", function(model){ 42 KGISapp.triggerEvent("modelChanged:userMeta",this); 43 }); 44 }, 45 validator: (function(){ 46 return new UserMetadataValidator(); 47 }()) 48});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.