X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.ria%2Fsrc%2Fargeo-ria-lib%2Fsecurity%2Fclass%2Forg%2Fargeo%2Fsecurity%2Fria%2Fcomponents%2FPasswordCredentialImpl.js;h=238cc7ef106d6e1be77eaa5ebfd90a1f52535a1a;hb=06f80b7b50619d1c997e2660eddb32a584cfc8a8;hp=610e56d12e7837d0b8d004e93d77d18187e39f02;hpb=98715b5696e21fcbc2d49f18f7bfac511569b897;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/PasswordCredentialImpl.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/PasswordCredentialImpl.js index 610e56d12..238cc7ef1 100644 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/PasswordCredentialImpl.js +++ b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/components/PasswordCredentialImpl.js @@ -7,6 +7,13 @@ qx.Class.define("org.argeo.security.ria.components.PasswordCredentialImpl", { properties : { valid : { init : false + }, + encoderCallback : { + init : function(string){ + var encoderShort = org.argeo.ria.util.Encoder; + return "{SHA}"+encoderShort.base64Encode(encoderShort.hexDecode(encoderShort.hash(string, "sha1"))); + }, + check : "Function" } }, @@ -28,15 +35,26 @@ qx.Class.define("org.argeo.security.ria.components.PasswordCredentialImpl", { getContainer : function(){ return this; }, - getData : function(format){return true;}, + getData : function(format){ + var encoded = null; + if(this.pass1.getValue() != ""){ + var encoder = this.getEncoderCallback(); + encoded = encoder(this.pass1.getValue()); + } + return encoded; + }, + clear : function(){ + this.pass1.setValue(""); + this.pass2.setValue(""); + }, validate : function(){ - if(this.pass1.getValue() == this.pass2.getValue()){ - this.setValid(true); - }else{ + if(this.pass1.getValue() != this.pass2.getValue() || this.pass1.getValue() == ""){ // TODO WHEN TESTING 0.8.3 //this.pass1.setValid(false); //this.pass2.setValid(false); this.setValid(false); + }else{ + this.setValid(true); } return this.getValid(); },