Skip to content

Instantly share code, notes, and snippets.

@ireneyiu
Created July 29, 2014 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ireneyiu/d2f7db90f96312236309 to your computer and use it in GitHub Desktop.
Save ireneyiu/d2f7db90f96312236309 to your computer and use it in GitHub Desktop.
wfApp.settings.Password.prototype.validate = function() {
if (!this.old.length) {
return {valid: false, errors: "Please enter your current password."};
} else if (this.newPass.length < 6) {
return {valid: false, errors: "New password must be at least 6 characters."};
} else if (this.newPass !== this.verify) {
return {valid: false, errors: "New password and confirmation do not match."};
} else if (this.newPass === this.old) {
return {valid: false, errors: "New password should be different from current password."};
} else {
return {valid: true};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment