Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/controllers/passwordless/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class SessionsController < Passwordless.config.parent_controller.constantize
# renders sessions/new.html.erb.
def new
@session = Session.new
unless params[:redirect_to].nil?
save_passwordless_redirect_location! authenticatable_class, params[:redirect_to]
end
end

# post '/:resource/sign_in'
Expand Down
6 changes: 4 additions & 2 deletions lib/passwordless/controller_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ def sign_out(authenticatable_class)
# Saves request.original_url as the redirect location for a
# passwordless Model.
# @param (see #authenticate_by_session)
# @param url [String] the url to redirect to
# @return [String] the redirect url that was just saved.
def save_passwordless_redirect_location!(authenticatable_class)
session[redirect_session_key(authenticatable_class)] = request.original_url
def save_passwordless_redirect_location!(authenticatable_class, url=nil)
url = request.original_url if url.nil?
set_passwordless_redirect_location! url
end

# Resets the redirect_location to root_path by deleting the redirect_url
Expand Down
Loading