File: api/src/form/password.js
// TODO indicate strength of password
/**
Password field
@namespace form
@class Password
@extends form.Text
@constructor
@description Form component for passwords.
@param {Object} config
@example
...
children:[
{type:'form.password',label:'Password',name:'password',md5:true },
{type:'form.password',label:'Repeat password',name:'password_repeated',md5:true }
]
...
*/
ludo.form.Password = new Class({
Extends:ludo.form.Text,
type:'form.Password',
inputType:'password',
/**
* Convert password to md5 hash
* getValue method will then return an md5 version of the password
* @attribute {Boolean} md5
*/
md5:false,
ludoConfig:function (config) {
this.parent(config);
if (config.md5 !== undefined)this.md5 = config.md5;
},
getValue:function () {
var val = this.parent();
if (val.length && this.md5) {
return faultylabs.MD5(val);
}
return val;
},
reset:function () {
this.setValue('');
}
});