Page redirect

Discussion in 'Ruby' started by Sharanya Suresh, Sep 30, 2009.

  1. Hi,

    In my application, if someone enters url which requires login, am
    redirecting to login page if they have not logged in already, after
    logging, i want to take the user to page from where he has been
    redirected to login page. how it can be done?

    example : questions/new -> redirected to login
    after logging, redirect user to questions/new

    How to do?

    Thankx in advance
    --
    Posted via http://www.ruby-forum.com/.
     
    Sharanya Suresh, Sep 30, 2009
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    Hi,
    The solution is simply save requested url in session and after user logged
    in send it back to
    the session url.

    If you are using restful authentication, you may get the solution,
    http://github.com/technoweenie/restful-authentication.

    # Redirect to the URI stored by the most recent store_location call or
    # to the passed default. Set an appropriately modified
    # after_filter :store_location, :eek:nly => [:index, :new, :show, :edit]
    # for any controller you want to be bounce-backable.


    def redirect_back_or_default(default)
    redirect_to(session[:return_to] || default)
    session[:return_to] = nil
    end


    On Wed, Sep 30, 2009 at 2:43 PM, Sharanya Suresh <>wrote:

    > Hi,
    >
    > In my application, if someone enters url which requires login, am
    > redirecting to login page if they have not logged in already, after
    > logging, i want to take the user to page from where he has been
    > redirected to login page. how it can be done?
    >
    > example : questions/new -> redirected to login
    > after logging, redirect user to questions/new
    >
    > How to do?
    >
    > Thankx in advance
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >



    --
    --
    Thanks and Regards
    Saurabh Purnaye
    +91-9922071155
    skype: sorab_pune
    yahoo & gtalk: saurabh.purnaye
    msn:
    --
    please don't print this e-mail unless you really need to.
     
    saurabh purnaye, Sep 30, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski
    Replies:
    1
    Views:
    7,140
  2. NWx
    Replies:
    3
    Views:
    474
  3. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,301
    Srowe1975
    Oct 15, 2008
  4. Sal
    Replies:
    1
    Views:
    807
  5. Ron Howard
    Replies:
    2
    Views:
    543
    Ron Howard
    Aug 11, 2004
Loading...

Share This Page