mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-08 04:48:44 +00:00
Implement 2FA (#577)
* Initial work for TOTP 2FA * Fix bug in 2FA code script * Add translations for two factor and /disable2fa * Fix compilation error * Add TwoFactorLoginPage * Add two factor login process * Little bit of backup code work * Finish two factor * Fix unit tests * ??? goofy ahh code * Use SHA-256 instead of SHA-512 * I guess SHA-256 doesn't work either * Fix comments in Base32 helper * Move QRCoder package to website * Add name to endregion comment in css * Fix bug with redirects
This commit is contained in:
parent
4fd1063502
commit
14d2f0305e
28 changed files with 1077 additions and 20 deletions
|
@ -40,6 +40,10 @@
|
|||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>ModPanel.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="TwoFactor.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>TwoFactor.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
|
||||
public static class TwoFactorStrings
|
||||
{
|
||||
public static readonly TranslatableString EnableTwoFactor = create("enable_2fa");
|
||||
public static readonly TranslatableString DisableTwoFactor = create("disable_2fa");
|
||||
|
||||
public static readonly TranslatableString TwoFactor = create("2fa");
|
||||
public static readonly TranslatableString TwoFactorDescription = create("2fa_description");
|
||||
public static readonly TranslatableString TwoFactorBackup = create("2fa_backup_description");
|
||||
|
||||
public static readonly TranslatableString TwoFactorRequired = create("2fa_required");
|
||||
|
||||
public static readonly TranslatableString DisableTwoFactorDescription = create("disable_2fa_description");
|
||||
|
||||
public static readonly TranslatableString InvalidCode = create("invalid_code");
|
||||
public static readonly TranslatableString InvalidBackupCode = create("invalid_backup");
|
||||
|
||||
public static readonly TranslatableString BackupCodeTitle = create("backup_title");
|
||||
public static readonly TranslatableString BackupCodeDescription = create("backup_description");
|
||||
public static readonly TranslatableString BackupCodeDescription2 = create("backup_description2");
|
||||
public static readonly TranslatableString BackupCodeConfirmation = create("backup_confirmation");
|
||||
public static readonly TranslatableString DownloadBackupCodes = create("backup_download");
|
||||
|
||||
public static readonly TranslatableString QrTitle = create("qr_title");
|
||||
public static readonly TranslatableString QrDescription = create("qr_description");
|
||||
|
||||
private static TranslatableString create(string key) => new(TranslationAreas.TwoFactor, key);
|
||||
}
|
|
@ -11,4 +11,5 @@ public enum TranslationAreas
|
|||
Error,
|
||||
Profile,
|
||||
ModPanel,
|
||||
TwoFactor,
|
||||
}
|
69
ProjectLighthouse.Localization/TwoFactor.resx
Normal file
69
ProjectLighthouse.Localization/TwoFactor.resx
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="enable_2fa" xml:space="preserve">
|
||||
<value>Enable Two-Factor</value>
|
||||
</data>
|
||||
<data name="disable_2fa" xml:space="preserve">
|
||||
<value>Disable Two-Factor</value>
|
||||
</data>
|
||||
<data name="qr_description" xml:space="preserve">
|
||||
<value>Once you have added this two factor code to your app of choice, enter a valid code below to finish the setup process</value>
|
||||
</data>
|
||||
<data name="qr_title" xml:space="preserve">
|
||||
<value>Here is your Two-Factor QR code</value>
|
||||
</data>
|
||||
<data name="backup_title" xml:space="preserve">
|
||||
<value>Backup codes</value>
|
||||
</data>
|
||||
<data name="backup_description" xml:space="preserve">
|
||||
<value>These codes will allow you to regain access to your account if you ever lose access to your 2FA device</value>
|
||||
</data>
|
||||
<data name="backup_description2" xml:space="preserve">
|
||||
<value>Save these codes somewhere because otherwise you may be locked out of your account</value>
|
||||
</data>
|
||||
<data name="backup_confirmation" xml:space="preserve">
|
||||
<value>I've saved these codes</value>
|
||||
</data>
|
||||
<data name="invalid_code" xml:space="preserve">
|
||||
<value>Invalid 2FA Code</value>
|
||||
</data>
|
||||
<data name="disable_2fa_description" xml:space="preserve">
|
||||
<value>To disable two-factor authentication, enter a correct code from your authenticator app.</value>
|
||||
</data>
|
||||
<data name="2fa" xml:space="preserve">
|
||||
<value>Two-Factor Authentication</value>
|
||||
</data>
|
||||
<data name="2fa_required" xml:space="preserve">
|
||||
<value>You are required to setup 2FA because of your role within this instance.</value>
|
||||
</data>
|
||||
<data name="2fa_description" xml:space="preserve">
|
||||
<value>Enter a valid 2FA code to continue</value>
|
||||
</data>
|
||||
<data name="2fa_backup_description" xml:space="preserve">
|
||||
<value>Alternatively, you can click {0}here{1} to enter one of your backup codes</value>
|
||||
</data>
|
||||
<data name="backup_download" xml:space="preserve">
|
||||
<value>Download backup codes</value>
|
||||
</data>
|
||||
<data name="invalid_backup" xml:space="preserve">
|
||||
<value>Invalid Backup Code</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Add table
Add a link
Reference in a new issue