Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom RecoveryCode generator #542

Closed
tomwelch opened this issue Jun 6, 2024 · 2 comments
Closed

Custom RecoveryCode generator #542

tomwelch opened this issue Jun 6, 2024 · 2 comments

Comments

@tomwelch
Copy link

tomwelch commented Jun 6, 2024

Hi,

Recently I had the situation where we wanted to customise the format of the recovery codes generate by Fortify. As RecoveryCode::generate() is called statically I had to extend a couple of actions and the TwoFactorAuthenticatable trait and override some methods to be able to call my own RecoveryCode class.

I can make a PR to make this more configurable, but I was wondering people's thoughts on binding RecoveryCode to the container vs. having a Fortify::generateRecoveryCodesUsing() method that could be placed in a service container?

Cheers,
Tom.

@tomwelch
Copy link
Author

Hi @crynobone,

The RecoveryCode class in Fortify generates codes with:

Str::random(10).'-'.Str::random(10)

I needed to create codes that were shorter and all lowercase. For example:

Str::lower(Str::random(6).'-'.Str::random(6))

What I'm proposing is to offer a way to make the Recovery Key generation customisable.

Cheers,
Tom.

@driesvints
Copy link
Member

Thank you @tomwelch. I believe the correct path forward here is to send in a PR so Taylor can look at some actual code. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants