mirror of
https://github.com/bitwarden/mobile
synced 2026-01-04 09:33:16 +00:00
totp code generation on view login
This commit is contained in:
@@ -13,6 +13,8 @@ namespace Bit.App.Models.Page
|
||||
private string _password;
|
||||
private string _uri;
|
||||
private string _notes;
|
||||
private string _totpCode;
|
||||
private int _totpSec = 30;
|
||||
private bool _revealPassword;
|
||||
private List<Attachment> _attachments;
|
||||
|
||||
@@ -194,6 +196,31 @@ namespace Bit.App.Models.Page
|
||||
public string ShowHideText => RevealPassword ? AppResources.Hide : AppResources.Show;
|
||||
public ImageSource ShowHideImage => RevealPassword ? ImageSource.FromFile("eye_slash") : ImageSource.FromFile("eye");
|
||||
|
||||
public string TotpCode
|
||||
{
|
||||
get { return _totpCode; }
|
||||
set
|
||||
{
|
||||
_totpCode = value;
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(TotpCode)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(TotpCodeFormatted)));
|
||||
}
|
||||
}
|
||||
public int TotpSecond
|
||||
{
|
||||
get { return _totpSec; }
|
||||
set
|
||||
{
|
||||
_totpSec = value;
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(TotpSecond)));
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(nameof(TotpColor)));
|
||||
}
|
||||
}
|
||||
public bool TotpLow => TotpSecond <= 7;
|
||||
public Color TotpColor => !string.IsNullOrWhiteSpace(TotpCode) && TotpLow ? Color.Red : Color.Black;
|
||||
public string TotpCodeFormatted => !string.IsNullOrWhiteSpace(TotpCode) ?
|
||||
string.Format("{0} {1}", TotpCode.Substring(0, 3), TotpCode.Substring(3)) : null;
|
||||
|
||||
public List<Attachment> Attachments
|
||||
{
|
||||
get { return _attachments; }
|
||||
|
||||
Reference in New Issue
Block a user