package components import "context" import "strings" type TwoFactorBackupCodesData struct { BackupCodes []string ErrorMessage string SuccessMessage string } templ TwoFactorBackupCodes(ctx context.Context, data TwoFactorBackupCodesData) { @LayoutWithContext("Two-Factor Authentication Backup Codes", ctx) {

2FA Backup Codes

These codes can be used to login if you lose access to your authenticator app

if data.ErrorMessage != "" { } if data.SuccessMessage != "" { if (strings.Contains(data.SuccessMessage, "IMPORTANT")) { // Show important messages with a different style and icon } else { } }
if len(data.BackupCodes) > 0 {

Your Backup Codes

Security information

These codes are your backup method to access your account.

  • Each code can only be used once.
  • Store these codes in a secure password manager.
  • These codes allow access to your account - keep them safe!
  • For security, you can only view codes immediately after generating them.
for _, code := range data.BackupCodes { if strings.Contains(code, "REDACTED") {
{ code }
} else {
{ code }
} }
if !strings.Contains(data.BackupCodes[0], "REDACTED") { }
} else {

No Backup Codes Available

You don't have any backup codes. Generate new ones for account recovery.

}
} }