lockup 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ module Lockup
8
8
  unless user_agent.match(/crawl|googlebot|slurp|spider|bingbot|tracker|click|parser|spider/)
9
9
  @codeword = params[:lockup_codeword].to_s.downcase
10
10
  @return_to = params[:return_to]
11
- if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase
11
+ if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && @codeword == Rails.application.secrets.lockup_codeword.to_s.downcase)
12
12
  set_cookie
13
13
  run_redirect
14
14
  end
@@ -20,7 +20,7 @@ module Lockup
20
20
  if request.post?
21
21
  @codeword = params[:lockup][:codeword].to_s.downcase
22
22
  @return_to = params[:lockup][:return_to]
23
- if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase
23
+ if @codeword == ENV["LOCKUP_CODEWORD"].to_s.downcase || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && @codeword == Rails.application.secrets.lockup_codeword.to_s.downcase)
24
24
  set_cookie
25
25
  run_redirect
26
26
  else
@@ -13,9 +13,9 @@
13
13
  <p><%= form.password_field "codeword", :value => @codeword, :class => 'nope' %></p>
14
14
  <% end %>
15
15
 
16
- <% if ENV["LOCKUP_HINT"].present? %>
16
+ <% if ENV["LOCKUP_HINT"].present? || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && Rails.application.secrets.lockup_hint.present?) %>
17
17
  <p id='hint_icon'>?</p>
18
- <p id='hint'><%= ENV["LOCKUP_HINT"] %></p>
18
+ <p id='hint'><%= ENV["LOCKUP_HINT"].present? ? ENV["LOCKUP_HINT"] : Rails.application.secrets.lockup_hint %></p>
19
19
  <% end %>
20
20
 
21
21
  <% if params[:return_to].present? %>
@@ -10,9 +10,9 @@ module Lockup
10
10
  private
11
11
 
12
12
  def check_for_lockup
13
- if ENV["LOCKUP_CODEWORD"].present?
13
+ if ENV["LOCKUP_CODEWORD"].present? || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && Rails.application.secrets.lockup_codeword.present?)
14
14
  if cookies[:lockup].present?
15
- if cookies[:lockup] == ENV["LOCKUP_CODEWORD"].to_s.downcase
15
+ if cookies[:lockup] == ENV["LOCKUP_CODEWORD"].to_s.downcase || ((Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 1) && cookies[:lockup] == Rails.application.secrets.lockup_codeword.to_s.downcase)
16
16
  return
17
17
  else
18
18
  redirect_to lockup.unlock_path(:return_to => request.fullpath.split('?lockup_codeword')[0], :lockup_codeword => params[:lockup_codeword])
@@ -1,3 +1,3 @@
1
1
  module Lockup
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - gb Studio
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-03-15 00:00:00 Z
18
+ date: 2014-10-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails