Skip to content

Commit

Permalink
handle 2fas digits=0 and period=0
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Feb 23, 2024
1 parent bed3570 commit ef7e1b8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions AuthenticatorPro.Core/src/Converter/TwoFasBackupConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,21 @@ public Authenticator Convert(IIconResolver iconResolver)
username = Otp.Account;
}

var digits = Otp.Digits > 0
? Otp.Digits
: type.GetDefaultDigits();

var period = Otp.Period > 0
? Otp.Period
: type.GetDefaultPeriod();

return new Authenticator
{
Secret = SecretUtil.Clean(Secret, type),
Issuer = issuer.Truncate(Authenticator.IssuerMaxLength),
Username = username.Truncate(Authenticator.UsernameMaxLength),
Digits = Otp.Digits,
Period = Otp.Period,
Digits = digits,
Period = period,
Counter = Otp.Counter,
Type = type,
Algorithm = algorithm,
Expand Down

0 comments on commit ef7e1b8

Please sign in to comment.