Coder Social home page Coder Social logo

asterisklabs / devise_google_authenticator Goto Github PK

View Code? Open in Web Editor NEW
216.0 216.0 155.0 186 KB

A Devise extension to allow your app to utilise Google's 2FA Mobile app

Home Page: http://labs.asteriskinfosec.com.au/tag/devise_google_authenticator/

License: MIT License

Ruby 90.06% JavaScript 0.69% CoffeeScript 0.34% CSS 2.31% HTML 6.59%

devise_google_authenticator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devise_google_authenticator's Issues

NoMethodError (undefined method `gauth_secret=' for #<User:0x007f532cdf8910>)

I'm having the most bizarre issue that I can't seem to get past. I am able to get the gem working in development and local production(read: rails s -e production). However, when I push the app up with dokku and create a user in a controller of mine, it says

NoMethodError (undefined method `gauth_secret=' for #<User:0x007f532cdf8910>):

I see the before_validation hook here:

       base.class_eval do
          before_validation :assign_auth_secret, :on => :create
          include InstanceMethods
        end

I see that it's blowing up on this line:

        def assign_auth_secret
          self.gauth_secret = ROTP::Base32.random_base32(64)
        end

The mixin in here should allow the gem to access my model and write to the table but I'm at a total loss why this works in every environment but production using Dokku.

Gemfile:

gem 'rails', '4.1.6'
gem 'pg', '0.17.1'
gem 'unicorn', '4.8.3'
gem 'active_model_serializers', '~> 0.8.0'
gem 'devise'
gem 'httparty'
gem 'sidekiq-pro'
gem 'validic'
gem 'oj'
gem 'clockwork'
gem 'devise_google_authenticator', '0.3.15'

ruby 2.1.3

DigitalOcean/Dokku info:

Ubuntu 14.04

Interestingly I was able to extract this method:

        def assign_auth_secret
          self.gauth_secret = ROTP::Base32.random_base32(64)
        end

into my User model and it works just fine.

Configure a CI server

There are some tests on this gem but they aren't executed automatically while they should (for PRs).

Use something like Travis CI in order to run them and validate PRs.

Custom Views

I did generate the devise_google_authenticator views with
rails g devise_google_authenticator:views users
which resulted in generating the views under the users folder
views/users/checkga & views/users/displayqr

My issue is when i login to the app it asks for the code views/users/checkga, how can i have the views/users/checkga as its own layout without rendering the entire app into the view. just have it as its own separate layout.

Things that i have tried

create a controller under the users folder checkga_controller.rb with layout "ga_check" under the views/layouts/ga_check.html.erb though it doesnt work. i also tried the same layout "ga_check" in the checkga_controller.rb in the devise_google_authenticator gem, that didnt work either. any ideas

Thank You.

Can't bundle install from fresh checkout

Hi,

I'm getting this output after cloning the repository:

❯ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    devise_google_authenticator (>= 0) ruby depends on
      railties (~> 3.0) ruby

    devise_google_authenticator (>= 0) ruby depends on
      railties (4.0.1)

I tried messing around with the gemspec, but can't get it to work unless I bump the required Rails version to 4.x. Probably locking to older devise would help, but that doesn't seem like a good idea.

Locales file missing some entries

Gem seems to work fine under Rails 5.0.2 w/ ruby 2.2.5.

I got warnings upon enable/disable, though, like this: "translation missing: en.devise.displayqr.user.enabled" and "...disabled". Adding those two lines to the end of config/locales/devise.google_authenticator.en.yml fixed this.

I was going to send in a patch but I'm not sure how to go about doing that on Github. Looks like these folks noticed it and have an updated file in their codebase:
https://github.com/MadDogTechnology/devise_google_authenticator/blob/master/config/locales/en.yml

Tests fail

Hi,

when using your Gemfile I'm getting:

➜  devise_google_authenticator git:(master) bundle exec rake
/Users/rmoriz/.rbenv/versions/1.9.3-p194/bin/ruby -I"lib:lib:test" -I"/Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1" "/Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb" "test/**/*_test.rb" 

==> Devise.orm = :active_record
/Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:82:in `<class:Base>': uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionHandler (NameError)
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:2:in `<module:ActiveRecord>'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:1:in `<top (required)>'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/base.rb:720:in `<top (required)>'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/rails_app/config/application.rb:14:in `<top (required)>'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/rails_app/config/environment.rb:2:in `require'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/rails_app/config/environment.rb:2:in `<top (required)>'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/test_helper.rb:6:in `require'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/test_helper.rb:6:in `<top (required)>'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/generators_test.rb:2:in `require'
    from /Users/rmoriz/Dropbox/Projekte/forks/devise_google_authenticator/test/generators_test.rb:2:in `<top (required)>'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:10:in `require'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:9:in `each'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:9:in `block in <main>'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:4:in `select'
    from /Users/rmoriz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/Users/rmoriz/.rbenv/versions/1.9.3-p194/b...]

Tasks: TOP => test
(See full trace by running task with --trace)
bundle exec rake  4,58s user 0,55s system 87% cpu 5,870 total

Alternative for this project?

In my sight, this project is not maintained more and more.

for verse up my rails project, i had to update devise too.

but this project is huddle for updating proejct.

anybody know alternative it?

NoMethodError: undefined method `to_key' for :user:Symbol

While running the tests I got this error. Any chance you understand it? (devise=3.2.4 in my Gemfile.lock)

[17/23] InvitationTest#test_user_is_not_prompted_for_token_again_after_first_login_until_remembertime_is_up = 0.02 s                        
  1) Error:
test_user_is_not_prompted_for_token_again_after_first_login_until_remembertime_is_up(InvitationTest):
NoMethodError: undefined method `to_key' for :user:Symbol
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.2.4/lib/devise/models/authenticatable.rb:204:in `serialize_into_session'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.2.4/lib/devise.rb:455:in `block (2 levels) in configure_warden!'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/session_serializer.rb:26:in `store'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.2.4/lib/devise/controllers/sign_in_out.rb:38:in `sign_in'
    /Users/redox/dev/devise_google_authenticator/app/controllers/devise/displayqr_controller.rb:9:in `show'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:436:in `_run__2550341926883609517__process_action__2030047739189359172__callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:42:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__4458982363860228573__call__2348933139888363517__callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in `request'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:230:in `process_request'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:57:in `get'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/capybara-1.1.4/lib/capybara/rack_test/browser.rb:62:in `process'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/capybara-1.1.4/lib/capybara/rack_test/browser.rb:21:in `visit'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/capybara-1.1.4/lib/capybara/rack_test/driver.rb:32:in `visit'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/capybara-1.1.4/lib/capybara/session.rb:157:in `visit'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/capybara-1.1.4/lib/capybara/dsl.rb:161:in `visit'
    /Users/redox/dev/devise_google_authenticator/test/integration_tests_helper.rb:23:in `create_and_signin_gauth_user'
    /Users/redox/dev/devise_google_authenticator/test/integration/gauth_test.rb:141:in `block in <class:InvitationTest>'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:447:in `_run__2705702850970494475__setup__2348933139888363517__callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/redox/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /Users/redox/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

NoMethodError in Devise::DisplayqrController#update

I got the error below, I'm using the current gem from rubygems.org, which is 0.3.8

Scenario: I already had a user setup with an authenticator and went to reset it to a new value.


undefined method `delete' for nil:NilClass
devise (3.2.2) lib/devise/models/database_authenticatable.rb:95:in `update_without_password'
devise_google_authenticator (0.3.9) lib/devise_google_authenticatable/models/google_authenticatable.rb:23:in `set_gauth_enabled'
devise_google_authenticator (0.3.9) app/controllers/devise/displayqr_controller.rb:16:in `update'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.14) lib/active_support/callbacks.rb:469:in `_run__377920596854344857__process_action__563741590051610989__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:339:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/mapper.rb:43:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/agent_hooks.rb:28:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/browser_monitoring.rb:23:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/developer_mode.rb:42:in `call'
rack (1.4.5) lib/rack/deflater.rb:13:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__1784068598659336236__call__3458702990119569212__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.14) lib/rails/engine.rb:484:in `call'
railties (3.2.14) lib/rails/application.rb:231:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.6.1) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.1) lib/thin/connection.rb:80:in `catch'
thin (1.6.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.1) lib/thin/connection.rb:55:in `process'
thin (1.6.1) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.1) lib/thin/backends/base.rb:73:in `start'
thin (1.6.1) lib/thin/server.rb:162:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.14) lib/rails/commands/server.rb:70:in `start'
railties (3.2.14) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.14) lib/rails/commands.rb:50:in `tap'
railties (3.2.14) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

Not compatible with rails 5

I used this gem by downloading it from github and placed in the rails app lib folder. I specified the :path in gemfile. Made some changes in the gem source code. Some of the methods were depreciated in rails 5, so i replaced them with the newer one's. This is very useful gem for 2FA. I suggest to don't stop this gem implementation, please continue its implementation. To make it compatible with rails 5, very small changes were needed. And also add backup code implementation.

Avoid patching Devise controllers

I'm using this gem with the devise_fido_usf gem in order to allow my user to chose a different 2FA option.

The expected workflow would be:

  1. Is Google Authenticator enabled? => No
  2. Is Fido U2F enabled? => No
  3. Redirect to the page to select the option

Then

  1. Is Google Authenticator enabled? => Yes
  2. Redirect to the check GA page

But as this gem is patching the Devise::SessionsController create action it is not possible to do it.

This gem should use the Warden::Manager.after_authentication callback in order to execute its code instead which would allow the above described workflow.

ActiveModel::MassAssignmentSecurity::Error in Devise::DisplayqrController#update

I got the error below, I'm using the current gem from rubygems.org, which is 0.3.8

I'm guessing that the following in displayqr_controller.rb:

  def resource_params
    return params.require(resource_name.to_sym).permit(:gauth_enabled) if strong_parameters_enabled?
    params
  end

Should actually be:

  def resource_params
    return params.require(resource_name.to_sym).permit(:gauth_enabled) if strong_parameters_enabled?
    params[:user]
  end

Can't mass-assign protected attributes: utf8, _method, authenticity_token, user, commit, action, controller
activemodel (3.2.14) lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes'
activemodel (3.2.14) lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal'
activemodel (3.2.14) lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'
activemodel (3.2.14) lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'
activerecord (3.2.14) lib/active_record/attribute_assignment.rb:75:in `assign_attributes'
activerecord (3.2.14) lib/active_record/persistence.rb:216:in `block in update_attributes'
activerecord (3.2.14) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:208:in `transaction'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/method_tracer.rb:524:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/method_tracer.rb:276:in `trace_execution_scoped'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/method_tracer.rb:519:in `transaction_with_trace_ActiveRecord_self_name_transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/persistence.rb:215:in `update_attributes'
devise (3.2.2) lib/devise/models/database_authenticatable.rb:98:in `update_without_password'
devise_google_authenticator (0.3.9) lib/devise_google_authenticatable/models/google_authenticatable.rb:23:in `set_gauth_enabled'
devise_google_authenticator (0.3.9) app/controllers/devise/displayqr_controller.rb:16:in `update'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.14) lib/active_support/callbacks.rb:469:in `_run__1275140421611138688__process_action__2861611677323709685__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:339:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.7.1.182) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/mapper.rb:43:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/agent_hooks.rb:28:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/browser_monitoring.rb:23:in `call'
newrelic_rpm (3.7.1.182) lib/new_relic/rack/developer_mode.rb:42:in `call'
rack (1.4.5) lib/rack/deflater.rb:13:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__882152244716231407__call__2391952966024774611__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.14) lib/rails/engine.rb:484:in `call'
railties (3.2.14) lib/rails/application.rb:231:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.6.1) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.1) lib/thin/connection.rb:80:in `catch'
thin (1.6.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.1) lib/thin/connection.rb:55:in `process'
thin (1.6.1) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.1) lib/thin/backends/base.rb:73:in `start'
thin (1.6.1) lib/thin/server.rb:162:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.14) lib/rails/commands/server.rb:70:in `start'
railties (3.2.14) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.14) lib/rails/commands.rb:50:in `tap'
railties (3.2.14) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

Parameters:

{"utf8"=>"✓",
 "_method"=>"put",
 "authenticity_token"=>"ytxB3kvbwO3FvB7XMAbz1vFm4uSGtkf/ESkKHhTynH8=",
 "user"=>{"gauth_enabled"=>"1"},
 "commit"=>"Continue..."}

Supporting Mongoid and Yubikey OTPs

Hi,
I was looking to extract some second factor auth stuff into a gem and found this to be a nice start. My requirements go a bit further in that I also need to support Yubikey and Mongoid.

I have a fork
https://github.com/eimermusic/devise_google_authenticator

Where I have:
• implemented support for Mongoid (3) (tests don't run Mongoid backend)
• Possibly broken AR support (tests still pass)
• Added Yubikey OTP support.
• Users can have Google (OATH TOTP) and Yubikey active at the same time and login using either one.
• Not aliasing create in sessions controller (using a before filter instead).
• Various other refactorings and changes.
• No new tests (yet) for my added features.

Because I have taken my fork 2 steps sideways I am not at all sure if any of it would be suitable to merge back. Let me know if you would like me to create some PRs for any of the changes.

Prevent from displaying QR code again

Hi

I would like to block access to users/displayqr because after user logs in, the session is used by people who are not supposed to be able able to open sessions themself.

Is there a way to patch the display qr controller?

Double sign in needed after I enter token

Hi everyone!

I am facing a weird issue which happens as follows:

  • user enters into URL, provides user+password+captcha (reCaptcha!) and click on LogIn
  • a new token is required so I open Authenticator app on my mobile and get a new token which I submit
  • I am being sent into logging view again and the following error is being shown: en.devise.failure.user.session_limited
  • I provide again user+password+captcha and submit the form and get logged in.
  • In case I logout and login again (before needing to re-enter a new token), no "double login" required.

Any idea or suggestion will be appreciated.

Regards.

Alejandro.

the name of variable in view differ from migrate file

the name of variable in view differ from migrate file as the name in the view is gauth_token and the name in the migrate file is gauth_secret

after i change the name in the view to gauth_secret it remove the error but get to me invalid token always

Use with Active Admin

I'm getting a route not found error when using Active Admin. I was able to get it to work by changing this line. But not sure the best way to fix it.

# respond_with resource, :location => { :controller => 'checkga', :action => 'show', :id => tmpid}
redirect_to "/admin/checkga?id=#{tmpid}"

Use inside engine

When using the gem in a mountable engine, and trying to run rake db:migrate:

NameError: uninitialized constant Devise::Models::GoogleAuthenticatable

Rake fails - can't register user

For some reason Capybara doesn't seem to be populating the new user registration page properly. If you insert a few "puts page.body" into the gauth_test.rb file you can see that the form appears to be getting populated, but, it's then complaining the username and email fields can't be blank.

Unsure exactly what's going on..

undefined method `to_prepare'

Running rails g devise_google_authenticator:install

There was an error while trying to load the gem 'devise_google_authenticator'.
Gem Load Error is: undefined method `to_prepare' for ActionDispatch::Callbacks:Class
Did you mean? to_param

Bundler Error Backtrace:
 (Bundler::GemRequireError)
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
	from /Users/e832319/work/ruby/BrownBoxServer/config/application.rb:7:in `<top (required)>'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
	from /Users/e832319/.rvm/gems/ruby-2.4.2@rails/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /Users/e832319/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/e832319/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'

mongoid and cancancan: uninitialized constant ActiveRecord::Base (NameError)

Hi,

I'm using mongoid (4.0.2). rails g devise_google_authenticator:install is throwing below error,

/Users/uname/.rvm/gems/ruby-2.1.2/gems/cancancan-1.9.2/lib/cancan/model_adapters/active_record_adapter.rb:146:in `<top (required)>': uninitialized constant ActiveRecord::Base (NameError)

Any idea why install command throwing error ?

Thanks

Not validating the guth token

when users hits users/displayqr,its displaying the show page from dispalyqr.
but on entering the current token its issuing error invalid token

def validate_token(token) method returning true in displayqrcontroller

!resource.validate_token(params[resource_name]['gauth_token'].to_i)

this condition is returning true.

Rethink name

The name of this gem implies that it is somehow related to "Google Authenticator". When in reality it simply allows "Two Factor Support" in devise.

When searching for a gem to help us implement two factor with devise, yours was off my radar because I wanted support for something more than just "Google authenticator". There are many 2 factor apps for both Android and iOS at this point and we don't want our users locked into one app

There is already https://github.com/tinfoil/devise-two-factor. The advantage you have over them is that you've worked out the second step a good bit of people are looking for. devise-two-factor/devise-two-factor#14

I recommend changing the name of this gem to "devise_two_factor" or "devise_two_factor_athentication" You'll surely see an increase in usage and contribution.

Allow configurable application name

google_authenticator_qrcode uses Rails.application.class.parent_name in generating the otpauth_user. This results in Google Authenticator displaying the rails application class name, which isn't always what should be displayed. In the case of the class name being a project name and not a public name, it can be confusing for the user. Suggest adding a ga_appname configuration item, that, if present, is used instead of Rails.application.class.parent_name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.