search for: intended_controller

Displaying 12 results from an estimated 12 matches for "intended_controller".

2006 Aug 07
2
Ugggh..another recipes question
...39;m guessing it''s coming from the redirect- def login if request.post? session[:user] = User.authenticate(params[:first_name], params[:last_name], params[:password]).id redirect_to :action => session[:intended_action], :controller => session[:intended_controller] I don''t see an explanation in the recipe about this redirect. Do I need it ? TIA Stuart
2006 Aug 12
7
Redirect back to last page?
I have a few pages where a user may do something (add tags, login, etc) and I would like to redirect them back to the last page they were at before calling that action. Is there an easy way to do this? -- Posted via http://www.ruby-forum.com/.
2006 Aug 13
3
Render nothing; go nowhere
...Any ideas? This is what my login/login action looks like. def login session[:user_id] = nil if request.post? user = User.authenticate(params[:name], params[:password]) if user session[:user_id] = user.id if session[:intended_action].nil? || session[:intended_controller].nil? if (@request.env[''HTTP_USER_AGENT''] == "MyCustomCClient") #did it come from my C++ program? #### <---- I need something here -----> #### else redirect_to(:action => "index") #deals with dir...
2006 Aug 07
8
Rails Recipes question - authenticating users
...;t think I''d be back so quick with another question but here goes: In this recipe for the signin or login (as I call it) there are these two lines if the user authenticates correctly: session[:user] = user.id redirect_to :action => session[:intended_action], :controller => session[:intended_controller] So I''m not seeing anything in the way of an explanation but reading the code it looks like there should be a session controller with a session action . Is that correct ? Right now I have a sessions table set up, I''ve made the changes in environment.rb to do sessions via an Acti...
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username and password, my setup is firstname, lastname, password. I seemed to be gramatically challenged and not sure how to set up the parameter list. Can anyone offer up a suggestion. The book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' ,
2006 Jul 07
13
Rails Recipes Book: Authentication
Hi, The user/login management system in Chapter 31: Authenticating Your Users and Chapter 32: Authorizing Users with Roles of Chad Fowler''s Rails Recipes looks reasonable and adequate. However, when I ran the Chapter 31 code, I get the following error: Username or password invalid And I am not even given the chance to sign in; that is, the signin form does not appear at all. Has
2006 Jul 09
1
Accessing the name of a controller''s module?
...looking at the API docs there is a class method called controller_path() that I have been trying to use, but no corresponding instance method that I could use. I might just not know the right syntax. My redirect code is: unless session[:user] session[:intended_location] = action_name session[:intended_controller] = controller_name flash[:notice] = "You must log in to continue." redirect_to :controller => "/account", :action => "log_in" end Then once the action I''m redirected to is completed I use this code to return the user to the appropriate original page...
2006 Jun 30
8
before_filter: nil vs. true vs. false
...How does the filter below work then (from the Rails Recipies book)? It would return nil if there''s a user in the session. Does nil count as true? before_filter :check_authentication def check_authentication unless session[:user] session[:intended_action] = action_name session[:intended_controller] = controller_name redirect_to :action => "signin" end end Thanks, Joel -- http://wagerlabs.com/
2006 Aug 01
0
How to retrieve :web when redirecting to an Instiki page?
...e page without any problem. So there seems to be a problem with the redirection in my signin method, which looks like this: def signin ession[:user] = User.authenticate(params[:username], params[:password]).id redirect_to :web=> session[:intended_web], :controller => session[:intended_controller], :action => session[:intended_action], :id => session[:intended_id] end I realize that session[:intended_web] is a naive attempt and returns nil since that session variable doesn''t exist, so how should I go about retrieving the intended web''s nam...
2006 Mar 21
13
"Remembering" link to redirect to after logging in
Hi, Suppose I have a resource such as http://localhost:3000/topsecret/data that requires the user to login first. What I did was make use of before_filter to check and see if the session variable is set with the logged in user''s id (similar to the example in "Agile Web Development with Rails"). However while the filtering function does work correctly in redirecting the
2006 Mar 13
7
Problem with params
...ew(params[:user]) # TODO: wrap this in a rescue block to handle exception authenticated_user = @user.try_to_authenticate if authenticated_user session[:user_id] = authenticated_user.id redirect_to :action => session[:intended_action], :controller => session[:intended_controller] else flash[:notice] = ''Invalid username or password.'' end end end I get an error on the User.find(..) line that there is no such thing as params[]. I had it working but then I edited/moved the code around, so can anybody suggest why it now will not s...
2006 Jul 02
3
2 before_filters, only want one to render something
...authorize skip admin_authorize? Or will I have to go through and pick only one method to be before_filtered for each action? def authorize #inspired by rails recipes unless session[:user] flash[:notice] = "Please log in" session[:intended_action] = action_name session[:intended_controller] = controller_name session[:intended_id] = params[:id] || nil redirect_to(:controller => "account", :action => "login") return end end def admin_authorize unless session[:user] && User.find(session[:user]).admin? redirect_to :controller=> &q...