From 332808027f1112a4a3d76642595b3392042703f2 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 30 Aug 2012 22:47:33 +0200 Subject: [PATCH] Make user name entry required. [FIXED] Prevent the ability to create a new user without user name. --- MasterPassword/iOS/MPUnlockViewController.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MasterPassword/iOS/MPUnlockViewController.m b/MasterPassword/iOS/MPUnlockViewController.m index 51be9719..cd2d6661 100644 --- a/MasterPassword/iOS/MPUnlockViewController.m +++ b/MasterPassword/iOS/MPUnlockViewController.m @@ -349,12 +349,20 @@ firstField.keyboardType = UIKeyboardTypeAlphabet; firstField.text = newUser.name; firstField.placeholder = @"eg. Robert Lee Mitchell"; + firstField.enablesReturnKeyAutomatically = YES; } tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { if (buttonIndex == [alert cancelButtonIndex]) { completion(NO); 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 newUser.name = [alert textFieldAtIndex:0].text;