mardi 26 juillet 2016

Swift User Creation Not Detecing UIText Length

working on user creation. Pretty simple idea, the email can't be nil or empty, password and confirm password have to be equal to be each other, and password has to be over 6 characters. For whatever reason, this last condition is always passing true. Because of this, users are able to register with a 1 letter or number password. Why would this be happening?

else if(emailTxt.text != "" &&  passwordTxt.text == confirmPassTxt.text && passwordTxt.text?.characters.count > 6){}

Also, something interesting, I can obviously compare the values because this code to get an password mismatch works perfectly fine.

else if(emailTxt.text != "" &&  passwordTxt.text != confirmPassTxt.text)

This will return true or false correctly. So the problems come from counting the characters, but I just can't see it right now. Simple mistake? Thanks everybody!

Aucun commentaire:

Enregistrer un commentaire