]> git.argeo.org Git - lgpl/argeo-commons.git/blob - components/PasswordCredentialImpl.js
Prepare next development cycle
[lgpl/argeo-commons.git] / components / PasswordCredentialImpl.js
1 qx.Class.define("org.argeo.security.ria.components.PasswordCredentialImpl", {
2 extend : qx.ui.container.Composite,
3 implement : [org.argeo.security.ria.components.ICredentialPane],
4 events : {
5 "modified" : "qx.event.type.Event"
6 },
7 properties : {
8 valid : {
9 init : false
10 }
11 },
12
13 construct : function(){
14 this.base(arguments);
15 this.setLayout(new qx.ui.layout.HBox(5, "center"));
16 this.add(new qx.ui.basic.Label("Password"), {flex:1});
17 this.pass1 = new qx.ui.form.PasswordField();
18 this.add(this.pass1, {flex:2});
19 this.add(new qx.ui.basic.Label("Confirm Password"), {flex:1});
20 this.pass2 = new qx.ui.form.PasswordField();
21 this.add(this.pass2, {flex:2});
22 this.pass1.addListener("changeValue", function(){this.fireEvent("modified");}, this);
23 this.pass2.addListener("changeValue", function(){this.fireEvent("modified");}, this);
24 this.pass2.addListener("changeValue", this.validate, this);
25 },
26
27 members : {
28 getContainer : function(){
29 return this;
30 },
31 getData : function(format){return true;},
32 validate : function(){
33 if(this.pass1.getValue() == this.pass2.getValue()){
34 this.setValid(true);
35 }else{
36 // TODO WHEN TESTING 0.8.3
37 //this.pass1.setValid(false);
38 //this.pass2.setValid(false);
39 this.setValid(false);
40 }
41 return this.getValid();
42 },
43 setEditMode : function(editMode){return true;}
44 }
45 });