refinery / refinerycms-authentication-devise

Devise based authentication extension for Refinery CMS
MIT License
17 stars 61 forks source link

Issue with login after deploy #27

Closed cheeyeo closed 4 years ago

cheeyeo commented 8 years ago

Hi

I wonder if anyone can help me with a query.

I just migrated an older (2.1) refinery cms app to 3.0 and added Refinerycms authentication devise and adapted the relevant changes including migrations.

I ran the production version of the app locally for testing and all works well. I can login as myself; create new users; and login as them too.

After I deployed the app into production, i can never login to the admin section. I kept being redirected back to the login screen despite the logs indicating I have logged in successfully:

Started POST "/refinery/users/login

Parameters: {"utf8"=>"✓", "authenticity_token"=>"LncwsHelAVFVFQVhClkxqSYNsWd6lQ3R4Z/nqLp6h41QiSXv3CBIzAqBVA3JUM9zNjr2lIGIpYHajlaD4hZbrQ==", "authentication_devise_user"=>{"login"=>"[FILTERED]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "locale"=>:en}

2016-09-02T20:21:35.243586+00:00 app[web.1]:   Refinery::Authentication::Devise::User Load (0.9ms)  SELECT  "refinery_authentication_devise_users".* FROM "refinery_authentication_devise_users" WHERE "refinery_authentication_devise_users"."id" = $1  ORDER BY "refinery_authentication_devise_users"."id" ASC LIMIT 1  [["id", 2]]
2016-09-02T20:21:35.246555+00:00 app[web.1]:    (0.7ms)  BEGIN
2016-09-02T20:21:35.248136+00:00 app[web.1]:   Refinery::Authentication::Devise::User Load (0.9ms)  SELECT  "refinery_authentication_devise_users".* FROM "refinery_authentication_devise_users" WHERE "refinery_authentication_devise_users"."id" = $1 LIMIT 1  [["id", 2]]
2016-09-02T20:21:35.250062+00:00 app[web.1]:   SQL (0.9ms)  UPDATE "refinery_authentication_devise_users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "refinery_authentication_devise_users"."id" = $5  [["last_sign_in_at", "2016-09-02 20:21:23.920704"], ["current_sign_in_at", "2016-09-02 20:21:35.244796"], ["sign_in_count", 15], ["updated_at", "2016-09-02 20:21:35.246702"], ["id", 2]]
2016-09-02T20:21:35.252253+00:00 app[web.1]:    (1.7ms)  COMMIT
2016-09-02T20:21:35.252727+00:00 app[web.1]: Redirected to http://xxxxxxx/refinery
2016-09-02T20:21:35.252802+00:00 app[web.1]: Filter chain halted as :require_no_authentication rendered or redirected
2016-09-02T20:21:35.252910+00:00 app[web.1]: Completed 302 Found in 12ms (ActiveRecord: 5.1ms)
2016-09-02T20:21:35.253411+00:00 app[web.1]: cache: [POST /refinery/users/login] invalidate, pass
2016-09-02T20:21:35.602813+00:00 app[web.1]: Started GET "/refinery" for 81.108.131.167 at 2016-09-02 20:21:35 +0000
2016-09-02T20:21:35.604712+00:00 app[web.1]: Processing by Refinery::Admin::CoreController#index as HTML
2016-09-02T20:21:35.604739+00:00 app[web.1]:   Parameters: {"locale"=>:en}
2016-09-02T20:21:35.605548+00:00 app[web.1]: Redirected to http://xxxxxx/refinery/login
2016-09-02T20:21:35.605624+00:00 app[web.1]: Filter chain halted as :authenticate_refinery_user! rendered or redirected

The UPDATE action indicates that i have logged in hence the sign_in count has also increased. yet I kept being redirected back?

Can anyone shed some light on this? I tried to create the same production environment locally as the remote app and I cannot work out the issue.

Thank You.

cheeyeo commented 8 years ago

I use Rack::Cache with memcached in production and have turned it on/off for testing and it does not make any difference.