solidusio / solidus_auth_devise

🔑 Devise authentication for your Solidus store.
http://solidus.io
BSD 3-Clause "New" or "Revised" License
52 stars 124 forks source link

Issue redirecting to Spree routes #100

Closed samdking closed 5 years ago

samdking commented 7 years ago

I was having an issue redirecting unauthenticated users to the correct URL: new_spree_user_session_url. Because this route is mounted within Spree, it doesn't detect this route and the FailureApp falls back to redirecting users to the homepage.

To fix this, the router_name config option for Spree::User must be set to :spree. This is already mentioned in the README as a fix for Confirmation errors (https://github.com/solidusio/solidus_auth_devise/commit/997382fcb1f6ed78a201ee7016384cfe71745aea#diff-04c6e90faac2675aa89e2176d2eec7d8R59). If this is in fact a global fix that's required, could the router_name be specified in the SpreeUser Devise setup in routes (https://github.com/solidusio/solidus_auth_devise/blob/master/config/routes.rb#L7) like so:

    devise_for(:spree_user, {
      class_name: 'Spree::User',
      controllers: {
        sessions: 'spree/user_sessions',
        registrations: 'spree/user_registrations',
        passwords: 'spree/user_passwords',
        confirmations: 'spree/user_confirmations'
      },
      skip: [:unlocks, :omniauth_callbacks],
      path_names: { sign_out: 'logout' },
      path_prefix: :user,
      router_name: :spree
    })
tvdeyen commented 7 years ago

I prefer this solution over the one mentioned in the readme, as the devise config is global, while the setting in the routes only effects us. Would you mind to open a PR?

jacobherrington commented 5 years ago

Solved by #125