Downloaded Two-Factor Backup Codes are not separated on Windows (only LF newline)

AI-generated summary

The discussion addresses a bug where downloaded Two-Factor Backup Codes on Windows are not properly separated, appearing as a single line of 320 characters due to the use of only LF (\n) newline characters instead of CRLF. sebix1 identified the issue in the codebase and suggested adding a carriage return character to ensure compatibility with Windows users, while maintaining functionality for Linux and macOS. pmusaraj welcomed the suggestion and requested a pull request. sebix1 submitted the fix via PR #29400. Although pmusaraj noted that the PR could not be merged until the contributor signed the Contributor License Agreement (CLA), zogstrip subsequently merged the pull request, resolving the issue.

The downloaded file generated by the Two-Factor Backup Codes function includes the 10 codes separated by an LF (\n) character.

Windows users will only see 320 characters in one line in this file instead of 10 separate codes.

The string with the backup codes is generated here:

Can we add a carriage return character too? For Linux/macOS users, this will make no difference in viewing the file, but it fixes the problem for Windows users.

I can also open a PR for this issue myself if that makes the implementation easier, but I want this to be reported and possibly discussed first.

3 Likes

Very reasonable suggestion, a PR would be most welcome. Thanks!

1 Like

Done: 2FA Backup Code Download: Use CRLF for Windows-compatibility by sebix · Pull Request #29400 · discourse/discourse · GitHub

4 Likes

Thanks @sebix1, we can’t merge your PR until you sign the CLA, though.

3 Likes

Just merged @sebix1’s PR

https://github.com/discourse/discourse/pull/29400

4 Likes

This topic was automatically closed after 15 hours. New replies are no longer allowed.