I'm trying to adapt a ruby setup where someone logs in to a bonjour
service via a web browser. I have the login screen which asks for host
and password. There is only one user per host and i can log in fine.
It's suppose to redirect me to /list in my browser but
doesn't. Once i've entered the correct login credentials and manually
add /list to the address i can see what i want. So the login seems to
work, it just doesn't redirect me. I need it to redirect me though when
the login is successful.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection
for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
def verify_login
unless session[:engine_host]
logger.debug "no engine host in session, redirecting to job/index"
redirect_to :controller => 'job', :action => 'index'
return false
end
return true
end
end
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection
for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
def verify_login
unless session[:engine_host]
logger.debug "no engine host in session, redirecting to job/index"
redirect_to :controller => 'job', :action => 'index'
return false
end
return true
end
end
This STILL doesn't work. Could it be because nowhere in here have i told
it where to redirect to? Can i add an IF statement to the def
verify_login in the application controller?
Hi
And what is wrong now? Did you ensure if session[:engine_host] is not
set it enters to unless session[:engine_host].....end
For example write some puts inside unless
session[:engine_host]......end
And check if that happens according to what you specify