mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-22 11:35:21 +01:00
clear value after invalid pin
This commit is contained in:
parent
1a9d58eecc
commit
98335c6acb
@ -27,12 +27,12 @@ namespace Bit.iOS.Core.Utilities
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UIAlertController CreateAlert(string title, string message, string accept)
|
public static UIAlertController CreateAlert(string title, string message, string accept, Action<UIAlertAction> acceptHandle = null)
|
||||||
{
|
{
|
||||||
var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
|
var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
|
||||||
var oldFrame = alert.View.Frame;
|
var oldFrame = alert.View.Frame;
|
||||||
alert.View.Frame = new RectangleF((float)oldFrame.X, (float)oldFrame.Y, (float)oldFrame.Width, (float)oldFrame.Height - 20);
|
alert.View.Frame = new RectangleF((float)oldFrame.X, (float)oldFrame.Y, (float)oldFrame.Width, (float)oldFrame.Height - 20);
|
||||||
alert.AddAction(UIAlertAction.Create(accept, UIAlertActionStyle.Default, null));
|
alert.AddAction(UIAlertAction.Create(accept, UIAlertActionStyle.Default, acceptHandle));
|
||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,7 @@ namespace Bit.iOS.Extension
|
|||||||
|
|
||||||
private void PinTextField_EditingChanged(object sender, EventArgs e)
|
private void PinTextField_EditingChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var newText = string.Empty;
|
SetLabelText();
|
||||||
for(int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
newText += PinTextField.Text.Length <= i ? "- " : "● ";
|
|
||||||
}
|
|
||||||
|
|
||||||
PinLabel.Text = newText.TrimEnd();
|
|
||||||
|
|
||||||
if(PinTextField.Text.Length >= 4)
|
if(PinTextField.Text.Length >= 4)
|
||||||
{
|
{
|
||||||
@ -70,14 +64,28 @@ namespace Bit.iOS.Extension
|
|||||||
{
|
{
|
||||||
// TODO: keep track of invalid attempts and logout?
|
// 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);
|
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)
|
partial void CancelButton_Activated(UIBarButtonItem sender)
|
||||||
{
|
{
|
||||||
CompleteRequest();
|
CompleteRequest();
|
||||||
|
Loading…
Reference in New Issue
Block a user