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.
Hi
If it is needed by more controllers not only jobs controller you can
move it to application.rb and the filter too…Does it call the filter?
Sijo
the before_filter only appears in the job controller.
this is what i have:
#------------------------------#
application_controller.rb
#------------------------------#
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
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
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
Sijo
Sijo,
my apologies, it looks like i wasn’t looking at the right part of the
script (this is how new i am to RoR!)
So, i found the part in the script which tells you about the login
redirection…