How to not accept things that are strings
model -> register function
call this.cleanUp()
Make this function above validate function
User.prototype.cleanUp = function() {
if(typeof(this.data.username) != "string") {this.data.username = ""}
if(typeof(this.data.email) != "string") {this.data.email = ""}
if(typeof(this.data.password) != "string") {this.data.password = ""}
}
For any other properties ignore them
// get rid of bogus properties
this.data = {
username = this.data.username.trim().toLowerCase(),
email = this.data.email.trim().toLowerCase(),
password = this.data.password
}