-
Notifications
You must be signed in to change notification settings - Fork 205
Adds support for multiple messages #216
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
Adds support for multiple messages #216
Conversation
f9fef63 to
b14a97c
Compare
|
Could you link me to the new devise functionality you're referring to? |
|
Sorry, I have maybe badly explained, but there’s no new Devise functionality so far, this PR introducing multiple messages will allow Devise to support multiple messages too. Nowadays the way Devise manages messages is by monkey patching the Models This implementation is a code smell to me, plus it doesn’t allow to have 2 alerts at the same time. In our use case we need to be able to show 2 alerts from the same request. I’m preparing a PR for Devise which will use the code from this PR to adapt Devise to send messages, removing the monkey patching and allow models to add many messages. Do not hesitate if you have any questions. |
db1bd4e to
baf7b14
Compare
|
@jsmestad I have open my PR on the devise project, hopefully this clarifies even more what we are trying to achieve. Could you please share your input about this change? |
This commit allow one to pass one or many messages to fail or success methods
baf7b14 to
f82a858
Compare
|
@jsmestad can you please give your feedback on this PR? |
|
If we can make this backwards compatible, I'd be interested in taking a closer look. Breaking existing integrations though is a much bigger ask and would need a really strong reason to break upstream dependencies on this 10+ year old library. |
|
That’s why I made it with depreciation warnings, keeping all the |
|
If there's anything you'd like me to do in this PR, please let me know, I'm ready to update it the way you like it. I understand the 10 years thing, but allowing to pass many messages instead of one doesn't look a huge thing to me, I'm pretty sure we can make it. |
|
Could you please give your feedback, a direction to get this merged? |
|
I appreciate the contribution. Failures have always worked in a fail-fast manner since Warden's inception. To go away from that given the level of stability and maturity of the warden library (16 years at this point), would require quite a compelling use-case. For now, I suggest maintaining this as a warden fork, if more use cases come up, I'm definitely open to considering this in the future. |
This PR allow one to pass a single message or a list of messages to the
failandsuccessmethods.This will allow the Device gem to pass those messages to warden, and get them displayed on the login pages.
Our use case is the following : We are adding a "delayable" strategy which adds exponential delay between login failures with an information message, and when a single login try remain, we want to show the alert telling about the delay before the user will be able to retry to login, and the alert that only one try remain before his account is being locked.
This PR also adds an
Earthlyfileand adocker-compose.ymlfile for convinience to run Rspec with Docker and Earthly with a single command:I can even update your Github workflow in order to use Earthly so that we truly benefit from a complete isolation avoiding to get tests failing on the CI, but not locally since Earthly runs Docker in Docker to the tests.