1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-14 07:13:33 +00:00

clear value after invalid pin

This commit is contained in:
Kyle Spearrin
2016-07-20 23:51:31 -04:00
parent 1a9d58eecc
commit 98335c6acb
2 changed files with 20 additions and 12 deletions

View File

@@ -51,13 +51,7 @@ namespace Bit.iOS.Extension
private void PinTextField_EditingChanged(object sender, EventArgs e)
{
var newText = string.Empty;
for(int i = 0; i < 4; i++)
{
newText += PinTextField.Text.Length <= i ? "- " : "● ";
}
PinLabel.Text = newText.TrimEnd();
SetLabelText();
if(PinTextField.Text.Length >= 4)
{
@@ -70,14 +64,28 @@ namespace Bit.iOS.Extension
{
// TODO: keep track of invalid attempts and logout?
var alert = Dialogs.CreateAlert(null, "Invalid PIN. Try again.", AppResources.Ok);
var alert = Dialogs.CreateAlert(null, "Invalid PIN. Try again.", AppResources.Ok, (a) =>
{
PinTextField.Text = string.Empty;
SetLabelText();
PinTextField.BecomeFirstResponder();
});
PresentViewController(alert, true, null);
PinTextField.Text = string.Empty;
PinTextField.BecomeFirstResponder();
}
}
}
private void SetLabelText()
{
var newText = string.Empty;
for(int i = 0; i < 4; i++)
{
newText += PinTextField.Text.Length <= i ? "- " : "● ";
}
PinLabel.Text = newText.TrimEnd();
}
partial void CancelButton_Activated(UIBarButtonItem sender)
{
CompleteRequest();