image_authentication 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +1 -1
  4. data/.travis.yml +3 -4
  5. data/Gemfile +1 -2
  6. data/README.md +3 -0
  7. data/image_authentication.gemspec +6 -4
  8. data/lib/image_authentication/controllers/helpers.rb +1 -1
  9. data/lib/image_authentication/routes.rb +3 -3
  10. data/lib/image_authentication/version.rb +1 -1
  11. data/spec/dummy/bin/rails +1 -1
  12. data/spec/dummy/bin/setup +34 -0
  13. data/spec/dummy/bin/update +29 -0
  14. data/spec/dummy/config/application.rb +3 -9
  15. data/spec/dummy/config/boot.rb +2 -4
  16. data/spec/dummy/config/cable.yml +10 -0
  17. data/spec/dummy/config/environment.rb +2 -2
  18. data/spec/dummy/config/environments/development.rb +27 -5
  19. data/spec/dummy/config/environments/production.rb +39 -31
  20. data/spec/dummy/config/environments/test.rb +12 -6
  21. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  22. data/spec/dummy/config/initializers/assets.rb +11 -0
  23. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  24. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  25. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
  26. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
  27. data/spec/dummy/config/initializers/session_store.rb +1 -1
  28. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
  29. data/spec/dummy/config/puma.rb +47 -0
  30. data/spec/dummy/config/routes.rb +3 -56
  31. data/spec/dummy/config/secrets.yml +22 -0
  32. data/spec/dummy/config/spring.rb +6 -0
  33. data/spec/dummy/db/schema.rb +3 -4
  34. data/spec/models/image_authenticable_spec.rb +6 -6
  35. data/spec/spec_helper.rb +4 -0
  36. metadata +66 -36
  37. data/spec/dummy/log/.keep +0 -0
  38. data/spec/dummy/log/development.log +0 -21
  39. data/spec/dummy/log/test.log +0 -613
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3df70887b9a073190b5519e962d29378959667c6
4
- data.tar.gz: 80a7aa2d2f743e16f8ee862b4100905073c99cc9
3
+ metadata.gz: 3499221e1723ea9cd2b8ae19084f3d1ebe738d03
4
+ data.tar.gz: 572fabaf586cc1ab2dcb6a8a8ab93f0f405b68e0
5
5
  SHA512:
6
- metadata.gz: 64eb5384b2e39fd7ca2471cb1f36cc419d3a16c5e84c56f849efd6ff6aa7213ee35152c34e530ac5adde4edf70635503cff4e2e0b0a149c7bb38fe749fff26f6
7
- data.tar.gz: a55276e16a9d1c7ddf4cde8ef58cc0b6b7d5181c84450d51c1b5832f2cc3f87c053d1240746075a29fd2bfb6eb32436fc425da33607aea8f58e9d97bfb8f6685
6
+ metadata.gz: 66f0de0471d4a9e985418c97985c03d8776dd805f7cd10b4bbc4185b5f51b1ac0491d8df2b438ad7f3f14d5fbb8468f90e0a69226ced50442e6fba997f4ca3a7
7
+ data.tar.gz: f5808b5e5c44fb85899b781923c09532cc2c2c01e556724094c8688da4f2027c6306f212e201b3ef1730bebf89b978bba1c7116588c569964924f4032f5767ab
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -16,6 +16,6 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .DS_Store
19
- spec/dummy/logs
19
+ spec/dummy/log
20
20
  spec/dummy/database.yml
21
21
  spec/dummy/db/*.sqlite3
@@ -1,14 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.0
4
- - 2.0.0
5
- - 1.9.3
3
+ - 2.2.2
4
+ - 2.3.1
6
5
  env:
7
6
  - DB=postgresql
8
7
  script:
9
8
  - RAILS_ENV=test bundle exec rake db:migrate --trace
10
9
  - bundle exec rake db:test:prepare
11
- - bundle exec rake
10
+ - bundle exec rake spec
12
11
  before_script:
13
12
  - cp spec/dummy/config/database.travis.yml spec/dummy/config/database.yml
14
13
  - psql -c 'create database image_authentication_test' -U postgres
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in devise_ip_filter.gemspec
4
- gemspec
3
+ gemspec
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  ## Image Based Authentication For Devise
2
2
 
3
3
  [![Build Status](https://travis-ci.org/invisiblelines/image_authentication.png?branch=master)](https://travis-ci.org/invisiblelines/image_authentication)
4
+ [![Code Climate](https://codeclimate.com/github/invisiblelines/image_authentication.png)](https://codeclimate.com/github/invisiblelines/image_authentication)
5
+ [![Dependency Status](https://gemnasium.com/invisiblelines/image_authentication.png)](https://gemnasium.com/invisiblelines/image_authentication)
6
+
4
7
 
5
8
  Allows your users to create an image based key that they must select after entering their usual email/password for added security.
6
9
 
@@ -16,13 +16,15 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_runtime_dependency 'rails', '>= 3.1.1'
20
- s.add_runtime_dependency 'devise'
19
+ s.add_runtime_dependency 'rails', '> 5.0.0'
20
+ s.add_runtime_dependency 'devise', '>= 4.1.1'
21
+ s.add_runtime_dependency 'coffee-rails'
21
22
 
22
23
  s.add_development_dependency 'bundler'
23
- s.add_development_dependency 'rspec-rails'
24
+ s.add_development_dependency 'rspec-rails', '~> 3.5.0.beta3'
24
25
  s.add_development_dependency 'sqlite3'
25
26
  s.add_development_dependency 'pg'
26
- s.add_development_dependency 'guard-rspec'
27
+ # s.add_development_dependency 'guard-rspec', '~> 4.7.0'
27
28
  s.add_development_dependency 'factory_girl_rails'
29
+ s.add_development_dependency 'coveralls'
28
30
  end
@@ -4,7 +4,7 @@ module ImageAuthentication
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- before_filter :handle_image_authentication
7
+ before_action :handle_image_authentication
8
8
  end
9
9
 
10
10
  private
@@ -3,7 +3,7 @@ module ActionDispatch::Routing
3
3
  protected
4
4
 
5
5
  def devise_image_authentication(mapping, controllers)
6
- resource :image_authentication,
6
+ resource :image_authentication,
7
7
  :only => [:show, :update, :enable, :disable, :confirm],
8
8
  :path => mapping.path_names[:image_authentication],
9
9
  :controller => controllers[:image_authentication] do
@@ -12,8 +12,8 @@ module ActionDispatch::Routing
12
12
  put :disable, :on => :member
13
13
 
14
14
  get :confirm, :on => :member
15
- put :confirm, :on => :member
15
+ patch :confirm, :on => :member
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module ImageAuthentication
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -1,7 +1,9 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative 'boot'
2
2
 
3
3
  require 'rails/all'
4
4
 
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
5
7
  Bundler.require(*Rails.groups)
6
8
 
7
9
  module Dummy
@@ -9,13 +11,5 @@ module Dummy
9
11
  # Settings in config/environments/* take precedence over those specified here.
10
12
  # Application configuration should go into files in config/initializers
11
13
  # -- all .rb files in that directory are automatically loaded.
12
-
13
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
14
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
15
- # config.time_zone = 'Central Time (US & Canada)'
16
-
17
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
18
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
19
- # config.i18n.default_locale = :de
20
14
  end
21
15
  end
@@ -1,5 +1,3 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
2
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,10 @@
1
+ # Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket.
2
+ production:
3
+ adapter: redis
4
+ url: redis://localhost:6379/1
5
+
6
+ development:
7
+ adapter: async
8
+
9
+ test:
10
+ adapter: async
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require_relative 'application'
3
3
 
4
4
  # Initialize the Rails application.
5
- Dummy::Application.initialize!
5
+ Rails.application.initialize!
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -9,21 +9,43 @@ Dummy::Application.configure do
9
9
  # Do not eager load code on boot.
10
10
  config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ if Rails.root.join('tmp/caching-dev.txt').exist?
17
+ config.action_controller.perform_caching = true
18
+
19
+ config.cache_store = :memory_store
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => 'public, max-age=172800'
22
+ }
23
+ else
24
+ config.action_controller.perform_caching = false
25
+
26
+ config.cache_store = :null_store
27
+ end
15
28
 
16
29
  # Don't care if the mailer can't send.
17
30
  config.action_mailer.raise_delivery_errors = false
18
31
 
32
+ config.action_mailer.perform_caching = false
33
+
19
34
  # Print deprecation notices to the Rails logger.
20
35
  config.active_support.deprecation = :log
21
36
 
22
- # Raise an error on page load if there are pending migrations
37
+ # Raise an error on page load if there are pending migrations.
23
38
  config.active_record.migration_error = :page_load
24
39
 
25
40
  # Debug mode disables concatenation and preprocessing of assets.
26
41
  # This option may cause significant delays in view rendering with a large
27
42
  # number of complex assets.
28
43
  config.assets.debug = true
44
+
45
+ # Raises error for missing translations
46
+ # config.action_view.raise_on_missing_translations = true
47
+
48
+ # Use an evented file watcher to asynchronously detect changes in source code,
49
+ # routes, locales, etc. This feature depends on the listen gem.
50
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
29
51
  end
@@ -1,11 +1,11 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
7
  # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
8
+ # your application in memory, allowing both threaded web servers
9
9
  # and those relying on copy on write to perform better.
10
10
  # Rake tasks automatically ignore this option for performance.
11
11
  config.eager_load = true
@@ -14,13 +14,9 @@ Dummy::Application.configure do
14
14
  config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
17
+ # Disable serving static files from the `/public` folder by default since
18
+ # Apache or NGINX already handles this.
19
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
20
 
25
21
  # Compress JavaScripts and CSS.
26
22
  config.assets.js_compressor = :uglifier
@@ -29,52 +25,64 @@ Dummy::Application.configure do
29
25
  # Do not fallback to assets pipeline if a precompiled asset is missed.
30
26
  config.assets.compile = false
31
27
 
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
28
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
34
29
 
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
30
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
31
+ # config.action_controller.asset_host = 'http://assets.example.com'
37
32
 
38
33
  # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
34
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
35
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
36
+
37
+ # Action Cable endpoint configuration
38
+ # config.action_cable.url = 'wss://example.com/cable'
39
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
40
+
41
+ # Don't mount Action Cable in the main server process.
42
+ # config.action_cable.mount_path = nil
41
43
 
42
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
45
  # config.force_ssl = true
44
46
 
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
47
50
 
48
51
  # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52
+ config.log_tags = [ :request_id ]
53
53
 
54
54
  # Use a different cache store in production.
55
55
  # config.cache_store = :mem_cache_store
56
56
 
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
57
+ # Use a real queuing backend for Active Job (and separate queues per environment)
58
+ # config.active_job.queue_adapter = :resque
59
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
60
+ config.action_mailer.perform_caching = false
63
61
 
64
62
  # Ignore bad email addresses and do not raise email delivery errors.
65
63
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
64
  # config.action_mailer.raise_delivery_errors = false
67
65
 
68
66
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation can not be found).
67
+ # the I18n.default_locale when a translation cannot be found).
70
68
  config.i18n.fallbacks = true
71
69
 
72
70
  # Send deprecation notices to registered listeners.
73
71
  config.active_support.deprecation = :notify
74
72
 
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
73
  # Use default logging formatter so that PID and timestamp are not suppressed.
79
74
  config.log_formatter = ::Logger::Formatter.new
75
+
76
+ # Use a different logger for distributed setups.
77
+ # require 'syslog/logger'
78
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
79
+
80
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
81
+ logger = ActiveSupport::Logger.new(STDOUT)
82
+ logger.formatter = config.log_formatter
83
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
84
+ end
85
+
86
+ # Do not dump schema after migrations.
87
+ config.active_record.dump_schema_after_migration = false
80
88
  end
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
@@ -12,19 +12,22 @@ Dummy::Application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
17
- config.static_cache_control = "public, max-age=3600"
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => 'public, max-age=3600'
19
+ }
18
20
 
19
21
  # Show full error reports and disable caching.
20
22
  config.consider_all_requests_local = true
21
23
  config.action_controller.perform_caching = false
22
24
 
23
25
  # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = true
26
+ config.action_dispatch.show_exceptions = false
25
27
 
26
28
  # Disable request forgery protection in test environment.
27
29
  config.action_controller.allow_forgery_protection = false
30
+ config.action_mailer.perform_caching = false
28
31
 
29
32
  # Tell Action Mailer not to deliver emails to the real world.
30
33
  # The :test delivery method accumulates sent emails in the
@@ -32,5 +35,8 @@ Dummy::Application.configure do
32
35
  config.action_mailer.delivery_method = :test
33
36
 
34
37
  # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :log
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
36
42
  end