Fixed return_to when authorization gets lost.
This commit is contained in:
parent
f6ff422405
commit
0364562273
2 changed files with 9 additions and 3 deletions
|
|
@ -11,7 +11,13 @@ class SessionsController < ApplicationController
|
|||
if user
|
||||
session[:user_id] = user.id
|
||||
session[:scope] = FoodsoftConfig.scope # Save scope in session to not allow switching between foodcoops with one account
|
||||
redirect_to session['return_to'] || root_url, :notice => "Logged in!"
|
||||
if session[:return_to].present?
|
||||
redirect_to_url = session[:return_to]
|
||||
session[:return_to] = nil
|
||||
else
|
||||
redirect_to_url = root_url
|
||||
end
|
||||
redirect_to redirect_to_url, :notice => "Logged in!"
|
||||
else
|
||||
flash.now.alert = "Invalid email or password"
|
||||
render "new"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue