Page redirect

S

Sharanya Suresh

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
 
S

saurabh purnaye

[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


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


--
--
Thanks and Regards
Saurabh Purnaye
+91-9922071155
skype: sorab_pune
yahoo & gtalk: saurabh.purnaye
msn: (e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top