passwordless icon indicating copy to clipboard operation
passwordless copied to clipboard

Support case-insensitive tokens?

Open StevenClontz opened this issue 9 months ago • 5 comments

My token generator uses only uppercase letters and numbers. When hand-entering the token, sometimes the user is lazy and writes letters in lowercase, which I want to allow. I'm supporting this by re-implementing Passwordless::Session, but it'd be nice if this was a configuration option.

StevenClontz avatar Feb 24 '25 03:02 StevenClontz

I think this could be an okay addition behind a config flag. Default is current implementation, so something like config.case_insensitive_tokens = true.

PRs welcome.

mikker avatar Feb 24 '25 08:02 mikker

WIP at https://github.com/mikker/passwordless/pull/249

StevenClontz avatar Feb 24 '25 15:02 StevenClontz

I've just spent some time debugging after a few user reports of code entry trouble, turns out it was this and people were naturally just 'expecting' case insensitivity! Very keen on this PR, might even be worth calling it out somewhere clearly in the readme as I feel like it's possibly a common tripwire for people?

(Edit: On closer inspection the detail included in the PR there is probably enough)

bluefantail avatar Mar 02 '25 03:03 bluefantail

I'm very fortunate to have an early adopter of my app who correctly pivoted to matching case. My stop gap fix is just including my own copy of session.rb (basically the PR version) in the app for now. Would be happy to return to vanilla in a future version if this is merged.

StevenClontz avatar Mar 02 '25 03:03 StevenClontz

Nice yeah, I've just been testing a modified version without the config since I only want the upcase version as the default anyway — seems good so far.

bluefantail avatar Mar 02 '25 07:03 bluefantail