Users are redirected to the url they clicked login/signup from (#446)

This commit is contained in:
farhatahmad
2019-04-11 12:45:43 -04:00
committed by Jesus Federico
parent d39a11059e
commit a14007743f
4 changed files with 71 additions and 5 deletions

View File

@ -32,7 +32,17 @@ module SessionsHelper
# If email verification is disabled, or the user has verified, go to their room
def check_email_verified(user)
if user.activated?
redirect_to user.main_room
# Get the url to redirect the user to
url = if cookies[:return_to] && cookies[:return_to] != root_url
cookies[:return_to]
else
user.main_room
end
# Delete the cookie if it exists
cookies.delete :return_to if cookies[:return_to]
redirect_to url
else
redirect_to resend_path
end