I have a registration form on an app im working on. You enter your email then your desired password and a verify password. It needs to check if the two password fieldspasswordFieldOne
and passwordFieldTwo
and not equal. They need to check if they are not equal for my error process to work correctly. Here are some things I tried.
if(passwordFieldOne != passwordFieldTwo){
//do whatever
}
-
if(passwordFieldOne.text != passwordFieldTwo.text){
//do whatever
}
-
if((passwordFieldOne.text == passwordFieldTwo.text) == False){
//do whatever
}
PS. Please dont respond telling me I can just check if they are equal, or check if they are equal and then say else. Thanks for your help.
-(BOOL)isPasswordMatch:(NSString *)pwd withConfirmPwd:(NSString *)cnfPwd {
//asume pwd and cnfPwd has not whitespace
if([pwd length]>0 && [cnfPwd length]>0){
if([pwd isEqualToString:cnfPwd]){
NSLog(@"Hurray! Password matches ");
return TRUE;
}else{
NSLog(@"Oops! Password does not matches");
return FALSE;
}
}else{
NSLog(@"Password field can not be empty ");
return FALSE;
}
return FALSE;
}