I am trying to redirect users to the last page they logged in from (using a modal) - which is working.
if user
# Protects against session fixation attacks, causes request forgery
# protection if user resubmits an earlier form using back
# button. Uncomment if you understand the tradeoffs.
# reset_session
self.current_user = user
new_cookie_flag = (params[:remember_me] == "1")
handle_remember_cookie! new_cookie_flag
format.html {
if @invitation.try(:invitee_email) == user.email
redirect_to(edit_invitation_path(@invitation))
else
begin
# loop check
if session[:last_back] != request.env['HTTP_REFERER']
redirect_to(:back)
session[:last_back] = request.env['HTTP_REFERER']
else
# raise on error
raise ActionController::RedirectBackError
end
rescue ActionController::RedirectBackError
# fallback on loop or other :back error
redirect_to(:action => :index)
end
end
If the user fails to login - they are redirected to a login page at session/new.
I don't want them going back to this page after successful login so how would I redirect them to a new/path if they happen to be coming from session/new?
I think there are two ways to solve this problem:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.