Coder Social home page Coder Social logo

Comments (19)

xntrik avatar xntrik commented on June 20, 2024

Working on this issue at the moment. Need a clever way to get the correct
respond_with dynamically back into the checkga controller.
On 27 Mar 2014 21:32, "carbonwallet" [email protected] wrote:

I don't seem to have anything in the routes.rb for google authenticator.
Should I have ?

Anyway when I signup (this is a new rails 4 app) I get the above error.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24
.

from devise_google_authenticator.

 avatar commented on June 20, 2024

Great thanks.

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

I've made a slight change to how some of the routes are dynamically generated.

This gem's routes are managed through devise, so you'll need to make sure that you've installed the devise gem first.

Can you give me the output of your rake routes command?

from devise_google_authenticator.

 avatar commented on June 20, 2024
rake routes
                  Prefix Verb   URI Pattern                    Controller#Action
                    root GET    /                              home#index
        new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
            user_session POST   /users/sign_in(.:format)       devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
           user_password POST   /users/password(.:format)      devise/passwords#create
       new_user_password GET    /users/password/new(.:format)  devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                         PATCH  /users/password(.:format)      devise/passwords#update
                         PUT    /users/password(.:format)      devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)        registrations#cancel
       user_registration POST   /users(.:format)               registrations#create
   new_user_registration GET    /users/sign_up(.:format)       registrations#new
  edit_user_registration GET    /users/edit(.:format)          registrations#edit
                         PATCH  /users(.:format)               registrations#update
                         PUT    /users(.:format)               registrations#update
                         DELETE /users(.:format)               registrations#destroy
          user_displayqr GET    /users/displayqr(.:format)     devise/displayqr#show
                         PATCH  /users/displayqr(.:format)     devise/displayqr#update
                         PUT    /users/displayqr(.:format)     devise/displayqr#update
            user_checkga GET    /users/checkga(.:format)       devise/checkga#show
                         PATCH  /users/checkga(.:format)       devise/checkga#update
                         PUT    /users/checkga(.:format)       devise/checkga#update
                   users GET    /users(.:format)               users#index
                         POST   /users(.:format)               users#create
                new_user GET    /users/new(.:format)           users#new
               edit_user GET    /users/:id/edit(.:format)      users#edit
                    user GET    /users/:id(.:format)           users#show
                         PATCH  /users/:id(.:format)           users#update
                         PUT    /users/:id(.:format)           users#update
                         DELETE /users/:id(.:format)           users#destroy

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

I've recently made a change that more gracefully determines how to respond_with after the user successfully enters their password. From version 0.3.11 this is in place, although the current version is 0.3.13.

Can you give it a shot with this updated gem and let me know if the error persists?

from devise_google_authenticator.

 avatar commented on June 20, 2024

I'm using GEM 0.3.13 and I still get the same error.

It's reproducible from a fresh rails install. i..e

rails new newapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

Then add the authenticator gem and try to register.

from devise_google_authenticator.

allcentury avatar allcentury commented on June 20, 2024

I'm also getting the same error

ActionController::UrlGenerationError at /users
No route matches {:action=>"show", :controller=>"devise_invitable/displayqr"}

from devise_google_authenticator.

zdraganov avatar zdraganov commented on June 20, 2024

What happens on this one? Some progress?

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

Sorry for the delay in this, will check the failed condition as per @carbonwallet's instructions above.

from devise_google_authenticator.

joshrendek avatar joshrendek commented on June 20, 2024

I actually run into this when I specify a registration controller in my routes:

  devise_for :users, :controllers => { :registrations => "registrations" }

Any ideas? As a side note I'm trying to redirect to a certain path after sign up but displayqr seems to be hijacking that.

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

Hi @joshrendek - the hijacking of the registration controller is also what devise_google_authenticator does. So you're probably running into a race condition after sign-up. I think I'll add a configurable option to enable/disable the displayqr page after sign-up. This way, you can configure this to disable, and therefore users won't be redirected to displayqr during sign-up, and the only way they can enable QR is if they visit the displayqr page.

from devise_google_authenticator.

joshrendek avatar joshrendek commented on June 20, 2024

@xntrik can you tell me where to look so i can monkey patch this for now? I wasn't able to find anything digging through the source :(

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

I'm still not entirely sure how to recreate this issue, but, I have a feeling it either relates to custom devise controllers (as in @joshrendek's situation) or something else? With the current master gem (which I am close to releasing as version 0.3.15), following these steps I'm not getting this issue. This is with ruby 2.0.0-p481 and rails 4.1.5.

Execute:

rails new testapp
cd testapp
vi Gemfile # or edit with whatever text editor you like

add:

gem 'devise'
gem 'devise_google_authenticator'

Then re-bundle and install devise and devise_google_authenticator, and configure it for the 'user' model

bundle
rails g devise:install
rails g devise user
rails g devise_google_authenticator:install
rails g devise_google_authenticator user

We then have to edit the app to use devise.

vi app/controllers/application_controller.rb

Add just before the end of the class

before_filter :authenticate_user!

Edit the routes file

vi config/routes.rb

Set a root. The only routes in here now should be devise_for :users, and whatever root you set

root 'home#index'

Create the home controller

vi app/controllers/home_controller.rb

Put something like this in there:

class HomeController < ApplicationController
  def index
  end
end

Create the home view

mkdir app/views/home
vi app/views/home/index.html.erb

Create a simple view:

Welcome home

Migrate the database

rake db:migrate

Then start the server

rails s

Now, when you visit http://localhost:3000 you'll be forwarded to the sign-in page, if you click 'sign-up', and enter an email and password twice, you should end up at http://localhost:3000/users/displayqr.

The output of rake routes should look like:

                  Prefix Verb   URI Pattern                        Controller#Action
        new_user_session GET    /users/sign_in(.:format)           devise/sessions#new
            user_session POST   /users/sign_in(.:format)           devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)          devise/sessions#destroy
           user_password POST   /users/password(.:format)          devise/passwords#create
       new_user_password GET    /users/password/new(.:format)      devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format)     devise/passwords#edit
                         PATCH  /users/password(.:format)          devise/passwords#update
                         PUT    /users/password(.:format)          devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)            devise/registrations#cancel
       user_registration POST   /users(.:format)                   devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)           devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)              devise/registrations#edit
                         PATCH  /users(.:format)                   devise/registrations#update
                         PUT    /users(.:format)                   devise/registrations#update
                         DELETE /users(.:format)                   devise/registrations#destroy
  refresh_user_displayqr POST   /users/displayqr/refresh(.:format) devise/displayqr#refresh
          user_displayqr GET    /users/displayqr(.:format)         devise/displayqr#show
                         PATCH  /users/displayqr(.:format)         devise/displayqr#update
                         PUT    /users/displayqr(.:format)         devise/displayqr#update
            user_checkga GET    /users/checkga(.:format)           devise/checkga#show
                         PATCH  /users/checkga(.:format)           devise/checkga#update
                         PUT    /users/checkga(.:format)           devise/checkga#update
                    root GET    /                                  home#index

If you don't want to redirect to the users/displayqr page after sign-up, you can uncomment the config.ga_bypass_signup option in config/initializers/devise.rb.

I'm keen to try and squash this bug - and I hope the above helps.

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

Haha, sorry @joshrendek - just pushed up to the repo now. But, you can see the changes in d0de660

from devise_google_authenticator.

joshrendek avatar joshrendek commented on June 20, 2024

Awesome its working :)

from devise_google_authenticator.

f3ndot avatar f3ndot commented on June 20, 2024

So I assume that this issue is now closed (or should be 😉 )?

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

Hi @f3ndot - I'm half waiting on whether @carbonwallet, @allcentury or @zdraganov are still having issues.

from devise_google_authenticator.

allcentury avatar allcentury commented on June 20, 2024

working for me now - thanks @xntrik

from devise_google_authenticator.

xntrik avatar xntrik commented on June 20, 2024

I'm going to close this - but - if anyone sees these errors this can be re-opened.

from devise_google_authenticator.

Related Issues (20)

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.