Update TotpViewer.razor (#672)

This commit is contained in:
Leendert de Borst
2025-03-11 14:17:49 +01:00
committed by Leendert de Borst
parent 0845477041
commit 038e8babb1

View File

@@ -106,6 +106,17 @@
return step - (int)(unixTimestamp % step);
}
/// <summary>
/// Gets the remaining percentage for the TOTP code.
/// </summary>
/// <returns>The remaining percentage.</returns>
private static int GetRemainingPercentage()
{
var remaining = GetRemainingSeconds();
// Invert the percentage so it counts down instead of up
return (int)(((30.0 - remaining) / 30.0) * 100);
}
/// <summary>
/// Refreshes the TOTP codes by generating new codes based on the secret keys.
/// </summary>
@@ -141,17 +152,6 @@
return newCode;
}
/// <summary>
/// Gets the remaining percentage for the TOTP code.
/// </summary>
/// <returns>The remaining percentage.</returns>
private int GetRemainingPercentage()
{
var remaining = GetRemainingSeconds();
// Invert the percentage so it counts down instead of up
return (int)(((30.0 - remaining) / 30.0) * 100);
}
/// <summary>
/// Copies the TOTP code to the clipboard.
/// </summary>