Files
openfoodnetwork/lib/spree/authentication_helpers.rb
Pau Perez 9be199a6cc Remove conflicting and duplicate route
This Spree route conflicts with the one we define:

```
get "/login", to: redirect("/#/login")
```

for whatever reason there are 7 users that managed to hit the Spree one
instead of ours when confirming their signup email. It's not clear to me
though when this `/login?validation=confirmed` is really hit. The
confirmation email link passes a token in the query params and this is
not the case.

The idea is that `GET /login` makes the login modal to show up instead
of Devise's default behaviour (through inheritance) of showing a login
form page. OFN was never prepared to handle this as this bug proofs.
2020-07-21 13:27:06 +02:00

23 lines
569 B
Ruby

module Spree
module AuthenticationHelpers
def self.included(receiver)
receiver.public_send :helper_method, :spree_current_user
receiver.public_send :helper_method, :spree_login_path
receiver.public_send :helper_method, :spree_signup_path
receiver.public_send :helper_method, :spree_logout_path
end
def spree_current_user
current_spree_user
end
def spree_login_path
main_app.login_path
end
delegate :signup_path, to: :spree, prefix: true
delegate :logout_path, to: :spree, prefix: true
end
end