Skip to content

Improve Devise config initializer #257

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

senemsoy
Copy link

@senemsoy senemsoy commented May 1, 2025

Summary

This fixes two issues: solidusio/solidus#3427 and #251

For the first one: we want to use the same email validator for both users and orders, to avoid validation errors when an email is being copied from a user to an order when an order is created.

For the second issue, we want to default the Devise.secret_key in the initializer to what Devise recommends: https://github.com/heartcombo/devise/blob/fec67f98f26fcd9a79072e4581b1bd40d0c7fa1d/lib/devise/rails/routes.rb#L498-L506

Testing

We tested this by creating a new Solidus app, changing the solidus_auth_devise version to this branch and re-ran the install task and confirmed the Devise config initializer had our new changes.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

senemsoy and others added 2 commits April 30, 2025 13:52
This is to prevent a situation where an email is valid on the User, but
invalid on the Order. This ensures that when an email is being copied
from the User when an order is being created, there are no validation
errors.

Co-authored-by: Jared Norman <[email protected]>
This is the default configuration Devise uses. What we had previously
sets the `Devise.secret_key` to a random value at application boot that
is not known across different instances of the same application.
This makes it obvious that this is an ERB template.

Co-authored-by: Jared Norman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants