Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View custom_auth_failure.rb
1 2 3 4 5 6 7
class CustomAuthenticationFailure < Devise::FailureApp
protected
 
def redirect_url
"/"
end
end
View custom_auth_failure.rb
1 2 3 4 5 6 7 8 9
# ...
config.warden do |manager|
manager[:default_strategies][:user].unshift :token_cookie_strategy
end
 
config.warden do |manager|
manager.failure_app = CustomAuthenticationFailure
end
# ...
View custom_auth_failure.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require 'spec_helper'
 
describe UsersController do
before :each do
@user = FactoryGirl.create(:user)
end
 
describe "User can log in using a token in a signed cookie" do
it "logs in with token in cookie" do
@user.ensure_authentication_token!
cookies[:authentication_token] = @user.authentication_token
get :personal
response.should render_template("personal")
# THE RESPONSE IS REDIRECT
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.