John Merlino
2012-Feb-27 20:13 UTC
delete a cookie when wrong password is entered in devise
How do you have control (in this case deleting a cookie) after devise
has determined that a user has entered the wrong password in the
latest version of devise. I have my own custom failure app but cookies
are not accessible within it:
class CustomFailureApp < Devise::FailureApp
def respond
unless request.format.to_sym == :html
http_auth
else
store_location!
flash[:alert] = i18n_message
if request.subdomain == ''abc'' &&
i18n_message.includes?
(''Invalid login or password'')
cookies.delete :tracker_for_external_clients
uri = URI(''http://abc.com/?page_id=425'')
params = { ''message'' => i18n_message }
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
if res.is_a?(Net::HTTPSuccess)
Rails.logger.info "The response is #{res.body}"
else
Rails.logger.info "Something went wrong"
end
redirect_to redirect_url
end
end
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.