Skip to content

Commit

Permalink
Merge pull request #45 from gblakeman/formatting-version-bump
Browse files Browse the repository at this point in the history
Version Bump - 1.4.4
  • Loading branch information
gblakeman authored Oct 1, 2018
2 parents 09e1475 + 6bd428a commit 7fb3e2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions FIST_BUMP.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A note of thanks from Grant ([@gblakeman](http://twitter.com/gblakeman)) and Jak

<img src="http://lockupgem.com/github_host/adventure_time_fist_bump.gif" width="450" height="253" alt="Fist Bump!" />

* Thanks to Marc van Hoof (https://github.com/mvanh) for adding support for Rails Credentials.
* Thanks to Nathan Broadbent (https://github.com/ndbroadbent) for finding an issue when the `HTTP_USER_AGENT` header is missing.
* Thanks (again) to Dan Rabinowitz (https://github.com/danrabinowitz) for adding support for customizing the length of the cookie.
* Thanks to Nathan Broadbent (https://github.com/ndbroadbent) for some nice refactoring and an additional check.
Expand Down
10 changes: 8 additions & 2 deletions lib/lockup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ def check_for_lockup
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])
redirect_to lockup.unlock_path(
return_to: request.fullpath.split('?lockup_codeword')[0],
lockup_codeword: params[:lockup_codeword],
)
end

def lockup_codeword_present?
ENV["LOCKUP_CODEWORD"].present? || ENV["lockup_codeword"].present? || (Rails.application.respond_to?(:secrets) && Rails.application.secrets.lockup_codeword.present?) || (Rails.application.respond_to?(:credentials) && Rails.application.credentials.lockup_codeword.present?)
ENV["LOCKUP_CODEWORD"].present? ||
ENV["lockup_codeword"].present? ||
(Rails.application.respond_to?(:secrets) && Rails.application.secrets.lockup_codeword.present?) ||
(Rails.application.respond_to?(:credentials) && Rails.application.credentials.lockup_codeword.present?)
end

def lockup_codeword
Expand Down
2 changes: 1 addition & 1 deletion lib/lockup/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Lockup
VERSION = "1.4.3"
VERSION = "1.4.4"
end
1 change: 1 addition & 0 deletions spec/controllers/lockup/lockup_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
post 'unlock', params: {foo: 'bar'}
end
end

describe 'a malicious user requests a format that is not HTML' do
it 'throws an unknown format error' do
lambda { get 'unlock', format: 'text' }.should raise_error(ActionController::UnknownFormat)
Expand Down

0 comments on commit 7fb3e2f

Please sign in to comment.