private void CheckPassword() { if (string.IsNullOrWhiteSpace(MasterPasswordCell.TextField.Text)) { var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword), AppResources.Ok); PresentViewController(alert, true, null); return; } var key = _cryptoService.MakeKeyFromPassword(MasterPasswordCell.TextField.Text, _authService.Email); if (key.Key.SequenceEqual(_cryptoService.Key.Key)) { _settings.AddOrUpdateValue(Constants.Locked, false); MasterPasswordCell.TextField.ResignFirstResponder(); LoadingController.DismissLockAndContinue(); } else { // TODO: keep track of invalid attempts and logout? var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, string.Format(null, AppResources.InvalidMasterPassword), AppResources.Ok, (a) => { MasterPasswordCell.TextField.Text = string.Empty; MasterPasswordCell.TextField.BecomeFirstResponder(); }); PresentViewController(alert, true, null); } }