mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Fixing the login redirection issue
This commit is contained in:
@@ -7,7 +7,8 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
request.referer || root_path
|
||||
referer_path = URI(request.referer).path
|
||||
[main_app.shop_checkout_path].include?(referer_path) ? referer_path : root_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
23
spec/features/consumer/authentication_spec.rb
Normal file
23
spec/features/consumer/authentication_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Authentication", js: true do
|
||||
describe "login" do
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
scenario "with valid credentials" do
|
||||
visit "/login"
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: "password"
|
||||
click_button "Login"
|
||||
current_path.should == "/"
|
||||
end
|
||||
|
||||
scenario "with invalid credentials" do
|
||||
visit "/login"
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: "this isn't my password"
|
||||
click_button "Login"
|
||||
page.should have_content "Invalid email or password"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,7 +138,6 @@ feature "As a consumer I want to check out my cart", js: true do
|
||||
end
|
||||
|
||||
it "shows ship address forms when selected shipping method requires one" do
|
||||
# Fancy Foundation Forms are weird
|
||||
choose(sm1.name)
|
||||
find("#ship_address").visible?.should be_true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user