2012-10-18 64 views
2

所以在我的本地主機上,自定義設計表單非常棒!沒有任何問題 - 當我從其他頁面上的自定義表單登錄時,它會按照預期將用戶登錄並重定向到主頁。在Heroku上設計登錄和註冊自定義表格不行爲

然而,當我部署到Heroku上,應用程序停止運行得 - 自定義窗體將用戶定向到實際的登錄頁面,無需登入他們

這是我的Heroku的日誌輸出:

2012-10-18T09:08:08+00:00 app[web.1]: Started POST "/user/sign_in" for 116.15.222.245 at 2012-10-18 09:08:08 +0000 
2012-10-18T09:08:08+00:00 app[web.1]: cache: [POST /user/sign_in] invalidate, pass 
2012-10-18T09:08:08+00:00 app[web.1]: Processing by UserSessionsController#create as HTML 
2012-10-18T09:08:08+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"4WDTRkX842UVz7nFuGbWbA3z47+rraKXQgl3PRYuWJY=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log In"} 
2012-10-18T09:08:08+00:00 app[web.1]: Redirected to https://example.com/user/sign_in 
2012-10-18T09:08:08+00:00 app[web.1]: Completed 302 Found in 11ms 
2012-10-18T09:08:08+00:00 heroku[router]: POST example.com/user/sign_in dyno=web.1 queue=0 wait=0ms service=16ms status=302 bytes=101 
2012-10-18T09:08:08+00:00 heroku[nginx]: 108.162.225.233 - - [18/Oct/2012:09:08:08 +0000] "POST /user/sign_in HTTP/1.1" 302 101 "http://example.com/referral_login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1" example.com 
2012-10-18T09:08:10+00:00 app[web.1]: 
2012-10-18T09:08:10+00:00 app[web.1]: Started GET "/user/sign_in" for 116.15.222.245 at 2012-10-18 09:08:10 +0000 
2012-10-18T09:08:10+00:00 app[web.1]: 
2012-10-18T09:08:10+00:00 heroku[router]: GET example.com/user/sign_in dyno=web.1 queue=0 wait=0ms service=16ms status=200 bytes=7835 
2012-10-18T09:08:10+00:00 app[web.1]: cache: [GET /user/sign_in] miss 
2012-10-18T09:08:10+00:00 app[web.1]: Processing by UserSessionsController#new as HTML 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_error_messages.html.erb (0.1ms) 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_login.html.erb (2.3ms) 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered user_sessions/new.html.erb within layouts/spree_application (3.0ms) 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_head.html.erb (1.0ms) 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_store_menu.html.erb (0.7ms) 
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_top_menu_bar.html.erb (0.5ms) 
2012-10-18T09:08:10+00:00 heroku[nginx]: 108.162.225.233 - - [18/Oct/2012:09:08:10 +0000] "GET /user/sign_in HTTP/1.1" 200 3412 "http://example.com/referral_login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1" example.com 

這是我在我的本地輸出:

Started POST "/user/sign_in" for 127.0.0.1 at 2012-10-18 17:21:36 +0800 
    Processing by UserSessionsController#create as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"m38Y47hk4UyGYAMnd76y5Qo2nK1Nv//v7s2+XdNHCbU=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log In"} 
    User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1 
    (23.6ms) SELECT COUNT(DISTINCT "users"."id") FROM "users" LEFT OUTER JOIN "roles_users" ON "roles_users"."user_id" = "users"."id" LEFT OUTER JOIN "roles" ON "roles"."id" = "roles_users"."role_id" WHERE "roles"."name" = 'admin' 
    (0.5ms) UPDATE "users" SET "last_sign_in_at" = '2012-10-18 05:56:54.897695', "current_sign_in_at" = '2012-10-18 09:21:39.033308', "sign_in_count" = 75, "updated_at" = '2012-10-18 09:21:39.081684' WHERE "users"."id" = 1 
Redirected to http://localhost:3000/ 
Completed 302 Found in 227ms 

Started GET "/" for 127.0.0.1 at 2012-10-18 17:21:39 +0800 
    Processing by LandingController#index as HTML 
    User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 
Rendered landing/index.html.erb within layouts/spree_application (1.7ms) 
Rendered shared/_head.html.erb (2.0ms) 
Rendered shared/_store_menu.html.erb (2.6ms) 
Rendered shared/_top_menu_bar.html.erb (1.7ms) 
    Tracker Load (0.3ms) SELECT "trackers".* FROM "trackers" WHERE "trackers"."active" = 't' AND "trackers"."environment" = 'development' LIMIT 1 
Rendered shared/_google_analytics.html.erb (14.1ms) 
Completed 200 OK in 183ms (Views: 148.1ms | ActiveRecord: 1.9ms) 

誰能幫助到一些啓發,爲什麼這可能是和如何去解決呢?我瀏覽了Devise wiki,做了一堆Google搜索,並嘗試了幾件沒有成功的事情。將不勝感激任何幫助!

回答

0

Spree默認在生產環境中需要SSL,所以如果您的POST請求不是https,它會重定向到登錄頁面。