a:41:{s:9:"#provides";s:28:"dojox.form.PasswordValidator";s:9:"#resource";s:25:"form/PasswordValidator.js";s:9:"#requires";a:2:{i:0;a:3:{i:0;s:6:"common";i:1;s:22:"dijit.form._FormWidget";i:2;s:5:"dijit";}i:1;a:3:{i:0;s:6:"common";i:1;s:28:"dijit.form.ValidationTextBox";i:2;s:5:"dijit";}}s:24:"dojox.form._ChildTextBox";a:4:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:28:"dijit.form.ValidationTextBox";}s:4:"call";a:1:{i:0;s:28:"dijit.form.ValidationTextBox";}}s:7:"summary";s:114:"A class that is shared between all our children - extends ValidationTextBox and provides some shared functionality";s:9:"classlike";b:1;}s:40:"dojox.form._ChildTextBox.containerWidget";a:3:{s:9:"prototype";s:24:"dojox.form._ChildTextBox";s:4:"type";s:6:"widget";s:7:"summary";s:34:"Our parent (the PasswordValidator)";}s:29:"dojox.form._ChildTextBox.type";a:3:{s:9:"prototype";s:24:"dojox.form._ChildTextBox";s:4:"type";s:6:"string";s:7:"summary";s:59:"Don't override this - we are all "password" types";}s:30:"dojox.form._ChildTextBox.reset";a:5:{s:9:"prototype";s:24:"dojox.form._ChildTextBox";s:4:"type";s:8:"Function";s:6:"source";s:108:" dijit.form.ValidationTextBox.prototype._setValueAttr.call(this, "", true); this._hasBeenBlurred = false;";s:7:"summary";s:183:"Force-set to empty string (we don't save passwords EVER)...and since _OldPWBox overrides _setValueAttr to check for empty string, call our parent class directly (not this.inherited())";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:52:"dijit.form.ValidationTextBox.prototype._setValueAttr";}}}s:35:"dojox.form._ChildTextBox.postCreate";a:4:{s:9:"prototype";s:24:"dojox.form._ChildTextBox";s:4:"type";s:8:"Function";s:6:"source";s:94:" this.inherited(arguments); if(!this.name){ dojo.removeAttr(this.focusNode, "name"); }";s:7:"summary";s:158:"We want to remove the "name" attribute from our focus node if we don't have one set - this prevents all our extra values from being posted on submit";}s:40:"dojox.form._ChildTextBox._hasBeenBlurred";a:3:{s:8:"instance";s:24:"dojox.form._ChildTextBox";s:7:"private";b:1;s:7:"summary";s:0:"";}s:20:"dojox.form._OldPWBox";a:4:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}s:4:"call";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}}s:7:"summary";s:54:"A class representing our "old password" box.";s:9:"classlike";b:1;}s:31:"dojox.form._OldPWBox._isPWValid";a:5:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:8:"instance";s:20:"dojox.form._OldPWBox";s:4:"type";s:7:"boolean";s:7:"summary";s:36:"Whether or not the password is valid";s:7:"private";b:1;}s:34:"dojox.form._OldPWBox._setValueAttr";a:7:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"newVal";a:1:{s:4:"type";s:8:"anything";}s:8:"priority";a:2:{s:8:"optional";b:1;s:4:"type";s:7:"boolean";}}s:6:"source";s:505:" if(newVal === ""){ newVal = dojox.form._OldPWBox.superclass.attr.call(this, "value"); } if(priority !== null){ // Priority is passed in as null, explicitly when this is an // update (not initially set). We want to check our password now. this._isPWValid = this.containerWidget.pwCheck(newVal); } this.inherited(arguments); // Trigger the containerWidget to recheck its value, if needed this.containerWidget._childValueAttr(this.containerWidget._inputWidgets[1].attr("value"));";s:7:"summary";s:103:"Updates _isPWValid if this isn't our initial update by calling our PasswordValidator's pwCheck function";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:36:"dojox.form._OldPWBox.superclass.attr";}}s:7:"private";b:1;}s:28:"dojox.form._OldPWBox.isValid";a:5:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"isFocused";a:1:{s:4:"type";s:7:"boolean";}}s:6:"source";s:2364:"dojo.provide("dojox.form.PasswordValidator"); dojo.require("dijit.form._FormWidget"); dojo.require("dijit.form.ValidationTextBox"); dojo.requireLocalization("dojox.form", "PasswordValidator"); dojo.declare("dojox.form._ChildTextBox", dijit.form.ValidationTextBox, { // summary: // A class that is shared between all our children - extends // ValidationTextBox and provides some shared functionality // // containerWidget: widget // Our parent (the PasswordValidator) containerWidget: null, // type: string // Don't override this - we are all "password" types type: "password", reset: function(){ // summary: // Force-set to empty string (we don't save passwords EVER)...and // since _OldPWBox overrides _setValueAttr to check for empty string, // call our parent class directly (not this.inherited()) dijit.form.ValidationTextBox.prototype._setValueAttr.call(this, "", true); this._hasBeenBlurred = false; }, postCreate: function(){ // summary: // We want to remove the "name" attribute from our focus node if // we don't have one set - this prevents all our extra values // from being posted on submit this.inherited(arguments); if(!this.name){ dojo.removeAttr(this.focusNode, "name"); } } }); dojo.declare("dojox.form._OldPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our "old password" box. // // _isPWValid: boolean // Whether or not the password is valid _isPWValid: false, _setValueAttr: function(/* anything */ newVal, /* boolean? */ priority){ // summary: // Updates _isPWValid if this isn't our initial update by calling // our PasswordValidator's pwCheck function if(newVal === ""){ newVal = dojox.form._OldPWBox.superclass.attr.call(this, "value"); } if(priority !== null){ // Priority is passed in as null, explicitly when this is an // update (not initially set). We want to check our password now. this._isPWValid = this.containerWidget.pwCheck(newVal); } this.inherited(arguments); // Trigger the containerWidget to recheck its value, if needed this.containerWidget._childValueAttr(this.containerWidget._inputWidgets[1].attr("value")); }, isValid: function(/* boolean */ isFocused){ // Take into account the isPWValid setting return this.inherited("isValid", arguments) && this._isPWValid;";s:7:"summary";s:0:"";}s:28:"dojox.form._OldPWBox._update";a:6:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:5:"event";}}s:6:"source";s:2563:"dojo.provide("dojox.form.PasswordValidator"); dojo.require("dijit.form._FormWidget"); dojo.require("dijit.form.ValidationTextBox"); dojo.requireLocalization("dojox.form", "PasswordValidator"); dojo.declare("dojox.form._ChildTextBox", dijit.form.ValidationTextBox, { // summary: // A class that is shared between all our children - extends // ValidationTextBox and provides some shared functionality // // containerWidget: widget // Our parent (the PasswordValidator) containerWidget: null, // type: string // Don't override this - we are all "password" types type: "password", reset: function(){ // summary: // Force-set to empty string (we don't save passwords EVER)...and // since _OldPWBox overrides _setValueAttr to check for empty string, // call our parent class directly (not this.inherited()) dijit.form.ValidationTextBox.prototype._setValueAttr.call(this, "", true); this._hasBeenBlurred = false; }, postCreate: function(){ // summary: // We want to remove the "name" attribute from our focus node if // we don't have one set - this prevents all our extra values // from being posted on submit this.inherited(arguments); if(!this.name){ dojo.removeAttr(this.focusNode, "name"); } } }); dojo.declare("dojox.form._OldPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our "old password" box. // // _isPWValid: boolean // Whether or not the password is valid _isPWValid: false, _setValueAttr: function(/* anything */ newVal, /* boolean? */ priority){ // summary: // Updates _isPWValid if this isn't our initial update by calling // our PasswordValidator's pwCheck function if(newVal === ""){ newVal = dojox.form._OldPWBox.superclass.attr.call(this, "value"); } if(priority !== null){ // Priority is passed in as null, explicitly when this is an // update (not initially set). We want to check our password now. this._isPWValid = this.containerWidget.pwCheck(newVal); } this.inherited(arguments); // Trigger the containerWidget to recheck its value, if needed this.containerWidget._childValueAttr(this.containerWidget._inputWidgets[1].attr("value")); }, isValid: function(/* boolean */ isFocused){ // Take into account the isPWValid setting return this.inherited("isValid", arguments) && this._isPWValid; }, _update: function(/* event */ e){ // Only call validate() if we've been blurred or else we get popups // too early. if(this._hasBeenBlurred){ this.validate(true); } this._onMouse(e);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.form._OldPWBox._getValueAttr";a:5:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:4:"type";s:8:"Function";s:6:"source";s:124:" if(this.containerWidget._started && this.containerWidget.isValid()){ return this.inherited(arguments); } return "";";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.form._OldPWBox._setBlurValue";a:6:{s:9:"prototype";s:20:"dojox.form._OldPWBox";s:4:"type";s:8:"Function";s:6:"source";s:3241:"dojo.provide("dojox.form.PasswordValidator"); dojo.require("dijit.form._FormWidget"); dojo.require("dijit.form.ValidationTextBox"); dojo.requireLocalization("dojox.form", "PasswordValidator"); dojo.declare("dojox.form._ChildTextBox", dijit.form.ValidationTextBox, { // summary: // A class that is shared between all our children - extends // ValidationTextBox and provides some shared functionality // // containerWidget: widget // Our parent (the PasswordValidator) containerWidget: null, // type: string // Don't override this - we are all "password" types type: "password", reset: function(){ // summary: // Force-set to empty string (we don't save passwords EVER)...and // since _OldPWBox overrides _setValueAttr to check for empty string, // call our parent class directly (not this.inherited()) dijit.form.ValidationTextBox.prototype._setValueAttr.call(this, "", true); this._hasBeenBlurred = false; }, postCreate: function(){ // summary: // We want to remove the "name" attribute from our focus node if // we don't have one set - this prevents all our extra values // from being posted on submit this.inherited(arguments); if(!this.name){ dojo.removeAttr(this.focusNode, "name"); } } }); dojo.declare("dojox.form._OldPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our "old password" box. // // _isPWValid: boolean // Whether or not the password is valid _isPWValid: false, _setValueAttr: function(/* anything */ newVal, /* boolean? */ priority){ // summary: // Updates _isPWValid if this isn't our initial update by calling // our PasswordValidator's pwCheck function if(newVal === ""){ newVal = dojox.form._OldPWBox.superclass.attr.call(this, "value"); } if(priority !== null){ // Priority is passed in as null, explicitly when this is an // update (not initially set). We want to check our password now. this._isPWValid = this.containerWidget.pwCheck(newVal); } this.inherited(arguments); // Trigger the containerWidget to recheck its value, if needed this.containerWidget._childValueAttr(this.containerWidget._inputWidgets[1].attr("value")); }, isValid: function(/* boolean */ isFocused){ // Take into account the isPWValid setting return this.inherited("isValid", arguments) && this._isPWValid; }, _update: function(/* event */ e){ // Only call validate() if we've been blurred or else we get popups // too early. if(this._hasBeenBlurred){ this.validate(true); } this._onMouse(e); }, _getValueAttr: function(){ if(this.containerWidget._started && this.containerWidget.isValid()){ return this.inherited(arguments); } return ""; }, _setBlurValue: function(){ // TextBox._setBlurValue calls this._setValueAttr(this.attr('value'), ...) // Because we are overridding _getValueAttr to return "" when the containerWidget // is not valid, TextBox._setBlurValue will cause OldPWBox's value to be set to "" // // So, we directly call ValidationTextBox._getValueAttr to bypass our _getValueAttr var value = dijit.form.ValidationTextBox.prototype._getValueAttr.call(this); this._setValueAttr(value, (this.isValid ? this.isValid() : true));";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:52:"dijit.form.ValidationTextBox.prototype._getValueAttr";}}s:7:"private";b:1;s:7:"summary";s:0:"";}s:20:"dojox.form._NewPWBox";a:4:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}s:4:"call";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}}s:7:"summary";s:45:"A class representing our new password textbox";s:9:"classlike";b:1;}s:29:"dojox.form._NewPWBox.required";a:3:{s:9:"prototype";s:20:"dojox.form._NewPWBox";s:4:"type";s:7:"boolean";s:7:"summary";s:54:"Whether or not this widget is required (default: true)";}s:29:"dojox.form._NewPWBox.onChange";a:4:{s:9:"prototype";s:20:"dojox.form._NewPWBox";s:4:"type";s:8:"Function";s:6:"source";s:85:" this.containerWidget._inputWidgets[2].validate(false); this.inherited(arguments);";s:7:"summary";s:78:"Validates our verify box - to make sure that a change to me is reflected there";}s:23:"dojox.form._VerifyPWBox";a:4:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}s:4:"call";a:1:{i:0;s:24:"dojox.form._ChildTextBox";}}s:7:"summary";s:39:"A class representing our verify textbox";s:9:"classlike";b:1;}s:31:"dojox.form._VerifyPWBox.isValid";a:5:{s:9:"prototype";s:23:"dojox.form._VerifyPWBox";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"isFocused";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:128:" return this.inherited("isValid", arguments) && (this.attr("value") == this.containerWidget._inputWidgets[1].attr("value"));";s:7:"summary";s:53:"Validates that we match the "real" password";}s:28:"dojox.form.PasswordValidator";a:4:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:27:"dijit.form._FormValueWidget";}s:4:"call";a:1:{i:0;s:27:"dijit.form._FormValueWidget";}}s:7:"summary";s:194:"A password validation widget that simplifies the "old/new/verify" style of requesting passwords. You will probably want to override this class and implement your own pwCheck function.";s:9:"classlike";b:1;}s:37:"dojox.form.PasswordValidator.required";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:8:"instance";s:28:"dojox.form.PasswordValidator";s:4:"type";s:7:"boolean";s:7:"summary";s:49:"Whether or not it is required for form submission";}s:42:"dojox.form.PasswordValidator._inputWidgets";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:8:"instance";s:28:"dojox.form.PasswordValidator";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.form.PasswordValidator.oldName";a:3:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:6:"string";s:7:"summary";s:58:"The name to send our old password as (when form is posted)";}s:41:"dojox.form.PasswordValidator.templatePath";a:2:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:7:"summary";s:0:"";}s:44:"dojox.form.PasswordValidator._hasBeenBlurred";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:8:"instance";s:28:"dojox.form.PasswordValidator";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.form.PasswordValidator.isValid";a:5:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"isFocused";a:1:{s:4:"type";s:7:"boolean";}}s:6:"source";s:141:" return dojo.every(this._inputWidgets, function(i){ if(i && i._setStateClass){ i._setStateClass(); } return (!i || i.isValid()); });";s:7:"summary";s:42:"we are valid if ALL our children are valid";}s:37:"dojox.form.PasswordValidator.validate";a:5:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"isFocused";a:1:{s:4:"type";s:7:"boolean";}}s:6:"source";s:229:" return dojo.every(dojo.map(this._inputWidgets, function(i){ if(i && i.validate){ i._hasBeenBlurred = (i._hasBeenBlurred || this._hasBeenBlurred); return i.validate(); } return true; }, this), "return item;");";s:7:"summary";s:49:"Validating this widget validates all our children";}s:34:"dojox.form.PasswordValidator.reset";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:6:"source";s:125:" this._hasBeenBlurred = false; dojo.forEach(this._inputWidgets, function(i){ if(i && i.reset){ i.reset(); } }, this);";s:7:"summary";s:45:"Resetting this widget resets all our children";}s:46:"dojox.form.PasswordValidator._createSubWidgets";a:5:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:6:"source";s:601:" var widgets = this._inputWidgets, msg = dojo.i18n.getLocalization("dojox.form", "PasswordValidator", this.lang); dojo.forEach(widgets, function(i, idx){ if(i){ var p = {containerWidget: this}, c; if(idx === 0){ p.name = this.oldName; p.invalidMessage = msg.badPasswordMessage; c = dojox.form._OldPWBox; }else if(idx === 1){ p.required = this.required; c = dojox.form._NewPWBox; }else if(idx === 2){ p.invalidMessage = msg.nomatchMessage; c = dojox.form._VerifyPWBox; } widgets[idx] = new c(p, i); } }, this); ";s:7:"summary";s:114:"Turns the inputs inside this widget into "real" validation widgets - and sets up the needed connections.";s:7:"private";b:1;}s:36:"dojox.form.PasswordValidator.pwCheck";a:5:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:8:"password";a:1:{s:4:"type";s:6:"string";}}s:6:"source";s:16:" return false; ";s:7:"summary";s:814:"Overridable function for validation of the old password box. This function is called and passed the old password. Return true if it's OK to continue, and false if it is not. IMPORTANT SECURITY NOTE: Do NOT EVER EVER EVER check this in HTML or JavaScript!!! You will probably want to override this function to callback to a server to verify the password (the callback will need to be syncronous) - and it's probably a good idea to validate it again on form submission before actually doing anything destructive - that's why the "oldName" value is available. And don't just fetch the password from the server either :) Send the test password (probably hashed, for security) and return from the server a status instead. Again - DON'T BE INSECURE!!! Security is left as an exercise for the reader :)";}s:39:"dojox.form.PasswordValidator.postCreate";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:6:"source";s:677:" this.inherited(arguments); // Turn my inputs into the correct stuff.... var widgets = this._inputWidgets = []; dojo.forEach(["old","new","verify"], function(i){ widgets.push(dojo.query("input[pwType=" + i + "]", this.containerNode)[0]); }, this); if (!widgets[1] || !widgets[2]){ throw new Error("Need at least pwType=\"new\" and pwType=\"verify\""); } if (this.oldName && !widgets[0]){ throw new Error("Need to specify pwType=\"old\" if using oldName"); } this._createSubWidgets(); this.connect(this._inputWidgets[1], "_setValueAttr", "_childValueAttr"); this.connect(this._inputWidgets[2], "_setValueAttr", "_childValueAttr"); ";s:7:"summary";s:363:"Sets up the correct widgets. You *MUST* specify one child text box (a simple HTML <input> element) with pwType="new" *and* one child text box with pwType="verify". You *MAY* specify a third child text box with pwType="old" in order to prompt the user to enter in their old password before the widget returns that it is valid.";}s:44:"dojox.form.PasswordValidator._childValueAttr";a:6:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"v";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:46:" this.attr("value", this.isValid() ? v : "");";s:7:"private";b:1;s:7:"summary";s:0:"";}s:45:"dojox.form.PasswordValidator._setDisabledAttr";a:6:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"value";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:130:" this.inherited(arguments); dojo.forEach(this._inputWidgets, function(i){ if(i && i.attr){ i.attr("disabled", value);} });";s:7:"private";b:1;s:7:"summary";s:0:"";}s:50:"dojox.form.PasswordValidator._setRequiredAttribute";a:6:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"value";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:254:" this.required = value; dojo.attr(this.focusNode, "required", value); dijit.setWaiState(this.focusNode, "required", value); this._refreshState(); dojo.forEach(this._inputWidgets, function(i){ if(i && i.attr){ i.attr("required", value);} });";s:7:"private";b:1;s:7:"summary";s:0:"";}s:42:"dojox.form.PasswordValidator._setValueAttr";a:6:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"v";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:69:" this.inherited(arguments); dojo.attr(this.focusNode, "value", v);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:42:"dojox.form.PasswordValidator._getValueAttr";a:5:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:6:"source";s:9252:"dojo.provide("dojox.form.PasswordValidator"); dojo.require("dijit.form._FormWidget"); dojo.require("dijit.form.ValidationTextBox"); dojo.requireLocalization("dojox.form", "PasswordValidator"); dojo.declare("dojox.form._ChildTextBox", dijit.form.ValidationTextBox, { // summary: // A class that is shared between all our children - extends // ValidationTextBox and provides some shared functionality // // containerWidget: widget // Our parent (the PasswordValidator) containerWidget: null, // type: string // Don't override this - we are all "password" types type: "password", reset: function(){ // summary: // Force-set to empty string (we don't save passwords EVER)...and // since _OldPWBox overrides _setValueAttr to check for empty string, // call our parent class directly (not this.inherited()) dijit.form.ValidationTextBox.prototype._setValueAttr.call(this, "", true); this._hasBeenBlurred = false; }, postCreate: function(){ // summary: // We want to remove the "name" attribute from our focus node if // we don't have one set - this prevents all our extra values // from being posted on submit this.inherited(arguments); if(!this.name){ dojo.removeAttr(this.focusNode, "name"); } } }); dojo.declare("dojox.form._OldPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our "old password" box. // // _isPWValid: boolean // Whether or not the password is valid _isPWValid: false, _setValueAttr: function(/* anything */ newVal, /* boolean? */ priority){ // summary: // Updates _isPWValid if this isn't our initial update by calling // our PasswordValidator's pwCheck function if(newVal === ""){ newVal = dojox.form._OldPWBox.superclass.attr.call(this, "value"); } if(priority !== null){ // Priority is passed in as null, explicitly when this is an // update (not initially set). We want to check our password now. this._isPWValid = this.containerWidget.pwCheck(newVal); } this.inherited(arguments); // Trigger the containerWidget to recheck its value, if needed this.containerWidget._childValueAttr(this.containerWidget._inputWidgets[1].attr("value")); }, isValid: function(/* boolean */ isFocused){ // Take into account the isPWValid setting return this.inherited("isValid", arguments) && this._isPWValid; }, _update: function(/* event */ e){ // Only call validate() if we've been blurred or else we get popups // too early. if(this._hasBeenBlurred){ this.validate(true); } this._onMouse(e); }, _getValueAttr: function(){ if(this.containerWidget._started && this.containerWidget.isValid()){ return this.inherited(arguments); } return ""; }, _setBlurValue: function(){ // TextBox._setBlurValue calls this._setValueAttr(this.attr('value'), ...) // Because we are overridding _getValueAttr to return "" when the containerWidget // is not valid, TextBox._setBlurValue will cause OldPWBox's value to be set to "" // // So, we directly call ValidationTextBox._getValueAttr to bypass our _getValueAttr var value = dijit.form.ValidationTextBox.prototype._getValueAttr.call(this); this._setValueAttr(value, (this.isValid ? this.isValid() : true)); } }); dojo.declare("dojox.form._NewPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our new password textbox // required: boolean // Whether or not this widget is required (default: true) required: true, onChange: function(){ // summary: // Validates our verify box - to make sure that a change to me is // reflected there this.containerWidget._inputWidgets[2].validate(false); this.inherited(arguments); } }); dojo.declare("dojox.form._VerifyPWBox", dojox.form._ChildTextBox, { // summary: // A class representing our verify textbox isValid: function(isFocused){ // summary: // Validates that we match the "real" password return this.inherited("isValid", arguments) && (this.attr("value") == this.containerWidget._inputWidgets[1].attr("value")); } }); dojo.declare("dojox.form.PasswordValidator", dijit.form._FormValueWidget, { // summary: // A password validation widget that simplifies the "old/new/verify" // style of requesting passwords. You will probably want to override // this class and implement your own pwCheck function. // // required: boolean // Whether or not it is required for form submission required: true, // inputWidgets: TextBox[] // An array of text boxes that are our components _inputWidgets: null, // oldName: string? // The name to send our old password as (when form is posted) oldName: "", templatePath: dojo.moduleUrl("dojox.form", "resources/PasswordValidator.html"), _hasBeenBlurred: false, isValid: function(/* boolean */ isFocused){ // summary: we are valid if ALL our children are valid return dojo.every(this._inputWidgets, function(i){ if(i && i._setStateClass){ i._setStateClass(); } return (!i || i.isValid()); }); }, validate: function(/* boolean */ isFocused){ // summary: Validating this widget validates all our children return dojo.every(dojo.map(this._inputWidgets, function(i){ if(i && i.validate){ i._hasBeenBlurred = (i._hasBeenBlurred || this._hasBeenBlurred); return i.validate(); } return true; }, this), "return item;"); }, reset: function(){ // summary: Resetting this widget resets all our children this._hasBeenBlurred = false; dojo.forEach(this._inputWidgets, function(i){ if(i && i.reset){ i.reset(); } }, this); }, _createSubWidgets: function(){ // summary: // Turns the inputs inside this widget into "real" validation // widgets - and sets up the needed connections. var widgets = this._inputWidgets, msg = dojo.i18n.getLocalization("dojox.form", "PasswordValidator", this.lang); dojo.forEach(widgets, function(i, idx){ if(i){ var p = {containerWidget: this}, c; if(idx === 0){ p.name = this.oldName; p.invalidMessage = msg.badPasswordMessage; c = dojox.form._OldPWBox; }else if(idx === 1){ p.required = this.required; c = dojox.form._NewPWBox; }else if(idx === 2){ p.invalidMessage = msg.nomatchMessage; c = dojox.form._VerifyPWBox; } widgets[idx] = new c(p, i); } }, this); }, pwCheck: function(/* string */ password){ // summary: // Overridable function for validation of the old password box. // // This function is called and passed the old password. Return // true if it's OK to continue, and false if it is not. // // IMPORTANT SECURITY NOTE: Do NOT EVER EVER EVER check this in // HTML or JavaScript!!! // // You will probably want to override this function to callback // to a server to verify the password (the callback will need to // be syncronous) - and it's probably a good idea to validate // it again on form submission before actually doing // anything destructive - that's why the "oldName" value // is available. // // And don't just fetch the password from the server // either :) Send the test password (probably hashed, for // security) and return from the server a status instead. // // Again - DON'T BE INSECURE!!! Security is left as an exercise // for the reader :) return false; }, postCreate: function(){ // summary: // Sets up the correct widgets. You *MUST* specify one child // text box (a simple HTML element) with pwType="new" // *and* one child text box with pwType="verify". You *MAY* // specify a third child text box with pwType="old" in order to // prompt the user to enter in their old password before the // widget returns that it is valid. this.inherited(arguments); // Turn my inputs into the correct stuff.... var widgets = this._inputWidgets = []; dojo.forEach(["old","new","verify"], function(i){ widgets.push(dojo.query("input[pwType=" + i + "]", this.containerNode)[0]); }, this); if (!widgets[1] || !widgets[2]){ throw new Error("Need at least pwType=\"new\" and pwType=\"verify\""); } if (this.oldName && !widgets[0]){ throw new Error("Need to specify pwType=\"old\" if using oldName"); } this._createSubWidgets(); this.connect(this._inputWidgets[1], "_setValueAttr", "_childValueAttr"); this.connect(this._inputWidgets[2], "_setValueAttr", "_childValueAttr"); }, _childValueAttr: function(v){ this.attr("value", this.isValid() ? v : ""); }, _setDisabledAttr: function(value){ this.inherited(arguments); dojo.forEach(this._inputWidgets, function(i){ if(i && i.attr){ i.attr("disabled", value);} }); }, _setRequiredAttribute: function(value){ this.required = value; dojo.attr(this.focusNode, "required", value); dijit.setWaiState(this.focusNode, "required", value); this._refreshState(); dojo.forEach(this._inputWidgets, function(i){ if(i && i.attr){ i.attr("required", value);} }); }, _setValueAttr: function(v){ this.inherited(arguments); dojo.attr(this.focusNode, "value", v); }, _getValueAttr: function(){ // Make sure we don't return undefined.... return this.inherited(arguments)||"";";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.form.PasswordValidator.focus";a:4:{s:9:"prototype";s:28:"dojox.form.PasswordValidator";s:4:"type";s:8:"Function";s:6:"source";s:179:" var f = false; dojo.forEach(this._inputWidgets, function(i){ if(i && !i.isValid() && !f){ i.focus(); f = true; } }); if(!f){ this._inputWidgets[1].focus(); }";s:7:"summary";s:109:"places focus on the first invalid input widget - if all input widgets are valid, the first widget is focused.";}s:10:"dojox.form";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}