Skip to content

Commit

Permalink
Merge pull request #35 from ndbroadbent/check_if_lockup_is_defined
Browse files Browse the repository at this point in the history
Check for the case where the engine is not mounted
  • Loading branch information
gblakeman authored Jun 1, 2018
2 parents b145175 + 3079e44 commit 14929d8
Showing 1 changed file with 4 additions and 11 deletions.
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

0 comments on commit 14929d8

Please sign in to comment.