search for: redirect_back_or_default

Displaying 20 results from an estimated 41 matches for "redirect_back_or_default".

2007 Jun 29
0
acts_as_authenticated, reset_session, and redirect_back_or_default
Just a question and an FYI I just installed rails and acts_as_authenticated and was setting up a site. Everything works fine except that in the AccountController that I generated the calls to the routine redirect_back_or_default don''t work because the call just before it to reset_session clears the session[:return_to] that the method uses to set where it will redirect. I ended up adding a version of redirect_back_or_default to the account controller that works for me (and as a benefit it keeps me from having to s...
2005 Nov 15
1
undefined method `redirect_back_or_default' w/ Salted Login Generator tests
Hi, I upgraded to Rails 0.14.3 and I am getting NoMethodError exceptions while running the functional tests for the Salted Login Generator. Is redirect_back_or_default no longer part of the ApplicationController? I don''t recall seeing anything about -- Frank Kim http://meetingkoreans.com http://betweengo.com
2006 Jul 04
1
LoginGenerator Problem
...' def login case @request.method when :post if @session[''user''] = User.authenticate(@params[''user_login''], @params[''user_password'']) flash[''notice''] = "Login successful" redirect_back_or_default :action => "welcome" else @login = @params[''user_login''] @message = "Login unsuccessful" end end end def signup case @request.method when :post @user = User.new(@params[''user''...
2006 Jan 27
1
Multiple Database write question
...ord].empty? and not @params[:post] [:passwordbis].empty? if @params[:post][:password] == @params[:post][:passwordbis] @newuser.password = @params[:post][:password] else notice += "Your passwords don''t match!" end end if not notice.empty? flash[:notice] = notice redirect_back_or_default :controller => "podcasts" else if not @updateuser.nil? and @updateuser.save flash[:notice] = _(''account_prefs_saved'') redirect_back_or_default :controller => "articles" @user = @updateuser else flash.now[:notice] = "An error occured...
2008 Aug 19
6
redirect with application add
...e can be invited too. If a user recieves an invite to a group and hasn''t yet added the application the filter chain ends up redirecting them to the main canvas page instead of the the group page directly. Is there a way to handle this if the user hasn''t installed the app, I tried redirect_back_or_default in one of my controllers but it ended up putting me into a loop. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20080819/039c1d05/attachment.html>
2007 Nov 17
18
Syntax Problem
...@pw = Digest::MD5.hexdigest(@s+@p) if @pw == #{user.hashed_password} flash.now[:notice] = "Passed" # need to write pw #user.crypted_password = self.encrypt("#{@params[:password]}") user.salt = user.old_salt user.save redirect_back_or_default(''/'') end end end This doesn''t seem to work (I know, it is not DRY), but the 2 passwords are equal. I admit, I am new to ruby so I am sure it is my TCL''sm working against me. Thanks --~--~---------~--~----~------------~-------~--~----~ You received t...
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
..._location redirect_to new_session end format.xml do request_http_basic_authentication ''Web Password'' end end end # Store the URI of the current request in the session. # # We can return to this location by calling #redirect_back_or_default. def store_location session[:return_to] = request.request_uri end # Redirect to the URI stored by the most recent store_location call or # to the passed default. def redirect_back_or_default(default) redirect_to(session[:return_to] || default) session[:return_...
2006 May 06
5
login generator always give login unsuccessfull
hi guys, i just did what it is written in this website to genrate login http://wiki.rubyonrails.org/rails/pages/HowToQuicklyDoAuthenticationWithLoginGenerator at the end i add to the database login and password but when i tried to login it give me login unsuccessfull can anyone help me thanks notice: i m beginner in webdeveloppement and especially ruby on rails -- Posted via
2007 Aug 27
2
send_file : downloaded file cannot be open after upload OK
...> URI.encode(@document.filename), :type => @document.content_type, :encoding => ''utf8'', :disposition => ''attachment'', :stream => ''true'', :buffer_size => ''4096'') redirect_back_or_default(home_url) end I got back the downloaded files... but i always get back a 16k whatever it''s pdf or jpeg, and when I try to open them, I got an error : Failed to find PDF header: `%PDF'' not found. for the pdf file and corrupted or not recognized.... what''s wrong in m...
2006 Jan 03
18
Trying to do a simple thing ...
Hi ! I was talking to a seasider and he asked me if it was easy to do the following thing using rails : 1) ask a number to the user 2) ask a second number 3) give the addition of the two number and a link to be able to replay All these things have to be done in one controller and one action, there is no need for verification and other stuff. I tried but I''ve got some problems
2005 Sep 02
7
Form to update two tables
...@companies = Company.new(@params[:company]) if @request.post? and @user.save @user.company_id= @companies.id # @session[:user] = User.authenticate(@user.login, @params[:user][:password]) flash[''notice''] = "Signup successful" redirect_back_or_default :action => "welcome" end end table COMPANIES --------------- CREATE TABLE companies ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(40) NOT NULL, info VARCHAR(40), modified_at DATETIME, created_at DATETIME, access DATETIME, PRIMARY KEY(id...
2006 May 03
0
Accessing the params hash in a functional test not working
...ogin action looks like: def login session[:debug_params] = params case @request.method when :post if session[:user] = User.authenticate(params[:user_email], params[:user_password]) flash[:notice] = "You are now logged in as "+session[:user].fullname redirect_back_or_default :action => "welcome" else flash[:error] = "The email address and/or password you entered is invalid.".t redirect_back_or_default :action => "login" end end end The test fails as follows. Note that session[:debug_params] is mis...
2008 Mar 07
0
ActiveRecordStore: cleanup & avoiding duplication
...NTROLLER def create self.current_user = User.authenticate(params[:login], params[:password]) if logged_in? session.model.user_id = current_user.id if params[:remember_me] == "1" self.current_user.remember_me end current_user.update_attribute(:online, true) redirect_back_or_default(''/'') else render :action => ''new'' end end def destroy self.current_user.forget_me if logged_in? reset_session current_user.update_attribute(:online, false) redirect_back_or_default(''/'') end FINDING SESSIONS @online_sessio...
2009 Feb 13
1
Help with return_back
I have to log in my app, after the login I want to return back to the page I was visiting just before the redirect to the login. Now, I have this in my Sessions controller: redirect_back_or_default(''/'') -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5...
2010 Feb 19
0
You are being redirected
...y>You are being <a href="http://www.example.com/ welcome">redirected</a>.</body></html> I do not know why this is happening or what I did to trigger this behaviour. The API does not give me any clues as to what is going on. The redirect command involved is: redirect_back_or_default(welcome_path) def redirect_back_or_default(default) redirect_to(session[:return_to] || default) session[:return_to] = nil end Up to today this has simply displayed the target page. I have no idea how or why the intermediate redirect page is generated. I would be very gratefu...
2011 Jun 29
6
RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)
...before_filter :require_user, :only => :destroy def new @user_session = UserSession.new @message = "Hello." end def create @user_session = UserSession.new(params[:user_session]) if @user_session.save flash[:notice] = "Login successful!" redirect_back_or_default admin_path else render :action => :new end end def destroy current_user_session.destroy flash[:notice] = "Logout successful!" redirect_back_or_default new_user_session_url end end ======== In views/user_sessions/new.html.erb: <!--user_sessions#ne...
2006 Jun 06
1
Redirect\Cookie bug with MSIE 5.5sp2
...n[:user] = User.authenticate(@params [:user_login], @params[:user_password]) return redirect_to(:action=>''send_confirmation'') unless @session[:user].confirmed? flash[:notice] = "Welcome back, " + @session [:user].display_name redirect_back_or_default "/" else flash.now[:notice] = "Sorry, we couldn''t log you in with that information. Please check your details and try again." @login = @params[:user_login] end end end And it works fine with all browsers but M...
2006 May 25
1
AppMailer and McCray''s theme generator
...AppMailer.deliver_alert("Login: #{@session[''user''][''name'']}","#{@session[''user''][''name'']} just logged on PTM") flash[''notice''] = "Login successful" redirect_back_or_default :controller => "welcome" else @login = @params[''user_login''] @message = "Login unsuccessful" end end end [...]
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 Feb 04
22
What''s the best way to embed a form?
I would like to embed my login form on my app''s home page. What''s the best way to render the login action of member controller from another action? Thanks Frank --------------------------------- Relax. Yahoo! Mail virus scanning helps detect nasty viruses! -------------- next part -------------- An HTML attachment was scrubbed... URL: