Skip to content

Improve Devise config initializer #257

Merged
jarednorman merged 3 commits into
solidusio:mainfrom
SuperGoodSoft:senem/change-init-email-regexp
Jun 6, 2025
Merged

Improve Devise config initializer #257
jarednorman merged 3 commits into
solidusio:mainfrom
SuperGoodSoft:senem/change-init-email-regexp

Conversation

@senemsoy

@senemsoy senemsoy commented May 1, 2025

Copy link
Copy Markdown
Contributor

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 3 commits May 28, 2025 13:07
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 <jared@super.gd>
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 <jared@super.gd>
@senemsoy senemsoy force-pushed the senem/change-init-email-regexp branch from ffc7890 to 3eadb06 Compare May 28, 2025 20:07
@jarednorman jarednorman requested a review from adammathys June 6, 2025 17:22
@jarednorman jarednorman merged commit 6b00723 into solidusio:main Jun 6, 2025
1 of 3 checks passed
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.

4 participants