Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for the case where the engine is not mounted #35

Merged
Merged
Changes from all 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
15 changes: 4 additions & 11 deletions lib/lockup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ module Lockup
private

def check_for_lockup
if lockup_codeword_present?
if cookies[:lockup].present?
if cookies[:lockup] == lockup_codeword
return
else
redirect_to lockup.unlock_path(return_to: request.fullpath.split('?lockup_codeword')[0], lockup_codeword: params[:lockup_codeword])
end
else
redirect_to lockup.unlock_path(return_to: request.fullpath.split('?lockup_codeword')[0], lockup_codeword: params[:lockup_codeword])
end
end
return unless respond_to?(:lockup) && lockup_codeword_present?
return if cookies[:lockup].present? && cookies[:lockup] == lockup_codeword

redirect_to lockup.unlock_path(return_to: request.fullpath.split('?lockup_codeword')[0], lockup_codeword: params[:lockup_codeword])
end

def lockup_codeword_present?
Expand Down