2
0

Make user name entry required.

[FIXED]     Prevent the ability to create a new user without user name.
This commit is contained in:
Maarten Billemont 2012-08-30 22:47:33 +02:00
parent cd64bff5ef
commit 332808027f

View File

@ -349,12 +349,20 @@
firstField.keyboardType = UIKeyboardTypeAlphabet; firstField.keyboardType = UIKeyboardTypeAlphabet;
firstField.text = newUser.name; firstField.text = newUser.name;
firstField.placeholder = @"eg. Robert Lee Mitchell"; firstField.placeholder = @"eg. Robert Lee Mitchell";
firstField.enablesReturnKeyAutomatically = YES;
} }
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
if (buttonIndex == [alert cancelButtonIndex]) { if (buttonIndex == [alert cancelButtonIndex]) {
completion(NO); completion(NO);
return; return;
} }
if (![alert textFieldAtIndex:0].text.length) {
[PearlAlert showAlertWithTitle:@"Name Is Required" message:nil viewStyle:UIAlertViewStyleDefault initAlert:nil
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
[self showNewUserNameAlertFor:newUser completion:completion];
} cancelTitle:@"Try Again" otherTitles:nil];
return;
}
// Save // Save
newUser.name = [alert textFieldAtIndex:0].text; newUser.name = [alert textFieldAtIndex:0].text;