UX: Improve second factor UI (PR #9526)

This will make a few minor improvements to the second factor user interface. Highlights include:

  • Using the site’s title to prefix the backup code filename. If non-ascii characters are detected, then prefix “discourse” instead.
  • Add icons and change the text on some of the buttons for better clarity and consistency
  • Add an education link to the security key modal


@martin-brennan can you review / merge

1 Like

I think having a unit test here will be great as documentation of what this function does :slight_smile:

Have to agree here, especially ^[\000-\177], I have no idea what that does.

LGTM, I reckon just add the unit test for siteTitleLowerCase and this is good to go, thanks Taylor! :+1:

@martin-brennan that one is making sure that the string has all ASCII characters using an octal range. (see here). I do agree that entire function is convoluted and needs some kind of explanation. What you see is me trying my best to work together a javascript equivalent to ruby’s parameterize. Extremely open to alternative ideas if you have any, otherwise I’ll work on a test next week!

together a javascript equivalent to ruby’s parameterize.

If that is the case, I think it’ll be good to move the function into a utilities directory. The function name will probably need to be updated because siteTitleLowerCase seems to suggest that it is just returning a lower cased site title.

Ah interesting @tshenry thanks for explaining :slight_smile: Utilities is the way to go then IMO

@tshenry do you need help on this? Ping me today if needed, I got some time.

should have a test for _

LGTM :+1: