Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DTA respect controller overrides it doesn't know about #1435

Merged
merged 1 commit into from
Nov 1, 2020

Conversation

akatz
Copy link
Contributor

@akatz akatz commented Oct 26, 2020

This builds off of #1420 and also tries to add tests for the routing logic.

To reiterate from that PR:

Why?

Currently there is no way to add customized controller when using mount_devise_token_auth_for. See more at https://github.com/lynndylanhurley/devise_token_auth/blob/master/lib/devise_token_auth/rails/routes.rb#L10-L23. For eg: adding customized controller for https://github.com/scambra/devise_invitable#configuring-controllers-.

How?

Allow controller option when using mount_devise_token_auth_for. Eg:

      sessions:  'api/users/sessions',
      passwords:  'api/users/passwords',
      token_validations:  'api/users/token_validations',
      invitations: 'api/users/invitations'
    }

Copy link
Collaborator

@MaicolBen MaicolBen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build still failed 😞

describe '#mount_devise_token_auth_for' do
before do
Rails.application.routes.draw do
# require 'pry';binding.pry
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this?

@akatz
Copy link
Contributor Author

akatz commented Oct 27, 2020

If anyone knows how to reproduce these failures locally I'm happy to look into it further. The contributor instructions don't work for me for some reason, and just running the main build passes or I would not have even bothered to open the PR.
EDIT: I've mostly got it figured out now

@MaicolBen MaicolBen merged commit 5ef7197 into lynndylanhurley:master Nov 1, 2020
cs0511 added a commit to HeadsUpHealth/devise_token_auth that referenced this pull request Nov 9, 2021
commit c922580
Author: ‮Artem Kozaev <artemkozaev@gmail.com>
Date:   Tue Dec 8 22:58:00 2020 +0300

    Add email validation errors via add (lynndylanhurley#1445)

commit 72ccd90
Author: Hu Hailin <tony.hu.hailin@gmail.com>
Date:   Wed Dec 9 04:57:39 2020 +0900

    rc causes issue for namespaced class, use mapping directly to keep behavior consistency with devise (lynndylanhurley#1440)

commit 8dba30b
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Tue Dec 8 16:57:19 2020 -0300

    Enable rails 6.1 (lynndylanhurley#1446)

commit 575272a
Author: Ali Deishidi <sizief@gmail.com>
Date:   Fri Dec 4 19:20:56 2020 +0330

    Update faq.md (lynndylanhurley#1439)

    Type was missing

commit 2a83ef9
Author: dominikdarnel <dominik.darnel@gmail.com>
Date:   Sun Nov 8 21:51:36 2020 +0100

    Update overrides.md (lynndylanhurley#1437)

    Overrideable methods RegistrationsController#render_destroy_success and RegistrationsController#render_destroy_error were missing from docs.

commit 5ef7197
Author: Avrohom Katz <iambpentameter@gmail.com>
Date:   Sun Nov 1 10:40:30 2020 -0500

    make DTA respect controller overrides it doesn't kow about (lynndylanhurley#1435)

commit 24da31e
Author: Paulo Ribeiro <plribeiro3000@gmail.com>
Date:   Sun Nov 1 12:39:35 2020 -0300

    feat(Route): Accept override (lynndylanhurley#1432)

commit 530b4ba
Author: JP Rosevear <jprosevear@gmail.com>
Date:   Mon Oct 19 17:32:04 2020 -0400

    Remove unnecessary require_relative the file should be autoloaded (lynndylanhurley#1433)

commit 576d0b0
Author: Martin Jaime <50113670+martinjaimem@users.noreply.github.com>
Date:   Mon Oct 19 18:31:44 2020 -0300

    Enhancement: remove unnecessary statement in destroy session (lynndylanhurley#1431)

commit 0c369d6
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Sun Oct 4 17:34:44 2020 -0300

    Serialize updated at without to s (lynndylanhurley#1423)

    * working 4.2 version

    * cleanup

    * Lock simplecov to last supported cc version

    codeclimate/test-reporter#413

    Co-authored-by: Brian Dunn <brianpatrickdunn@gmail.com>

commit bb3e3f0
Author: Brent Dearth <brent.dearth@gmail.com>
Date:   Tue Sep 1 11:05:33 2020 -0600

    chore(deps): remove Sprockets requirement (lynndylanhurley#1428)

commit bef1b0b
Author: ngouy <nathangouy@free.fr>
Date:   Sat Jul 25 14:43:00 2020 -0400

    missing space in migration generator (lynndylanhurley#1422)

    So everything is nicely aligned if you uncomment this

commit b409997
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Sun Jun 21 21:53:29 2020 -0300

    Avoid failing on undefined variable for invalid record (lynndylanhurley#1416)

commit 30a1aff
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Sun Jun 21 21:52:43 2020 -0300

    Avoid nullyfing token when current_user is called before (lynndylanhurley#1417)

commit ae3547c
Author: Charlie Hua <compassion.wisdom@gmail.com>
Date:   Sun Jun 21 04:37:15 2020 +0800

    Memorize current_#{group_name} to avoid error (lynndylanhurley#722)

    Currently current_#{group_name} (ex. current_member) is not memorized as current_#{mapping} (ex. current_user) is.
    Instead, it calls set_user_by_token every time, and this could cause error if current_member is called after token is changed (maybe by some other request) and return nil

commit 849c244
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Sat Jun 20 00:39:42 2020 -0300

    Fix parent class name generator for rails 6 (lynndylanhurley#1414)

commit 449a0be
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Fri Jun 19 20:09:26 2020 -0300

    Reduce config variables doc table width (lynndylanhurley#1413)

commit 4461a09
Author: Hai Phan Nguyen <pnghai@gmail.com>
Date:   Sat Jun 20 05:27:45 2020 +0700

    Fix crash on devise 4.7.2+ (lynndylanhurley#1412)

    * Ignore sync uid in case confirmable mail changed

    * Update user_omniauth_callbacks.rb

    * Update user_omniauth_callbacks.rb

    * fix crash on devise 4.7.2+

commit bb09616
Author: Hai Phan Nguyen <pnghai@gmail.com>
Date:   Wed Jun 10 20:56:28 2020 +0700

    Ignore sync uid in case confirmable mail changed (lynndylanhurley#1407)

    * Ignore sync uid in case confirmable mail changed

    * Update user_omniauth_callbacks.rb

    * Update user_omniauth_callbacks.rb

commit b3d53b6
Author: Maicol Bentancor <maicol.bentancor@gmail.com>
Date:   Tue Jun 2 15:07:22 2020 -0300

    Bump version to 1.1.4 (lynndylanhurley#1406)

commit 2a01f4f
Author: Jamal Mohammed <jamal@mdjamal.com>
Date:   Tue Jun 2 22:07:49 2020 +0530

    Update faq.md (lynndylanhurley#1401)

    Updated FAQ to add **allow_password_change** column if not already added in existing User model.

commit 387306a
Author: Sai Chander <saichander17@gmail.com>
Date:   Wed Apr 29 08:43:10 2020 +0800

    Issue - 1358 Argument error when converting token updated_at using to_time fixed (lynndylanhurley#1388)

commit a3595f4
Author: David Loukidelis <david@loukidelis.com>
Date:   Tue Apr 28 20:41:32 2020 -0400

    Update omniauth_callbacks_controller.rb (lynndylanhurley#1398)

commit ef965d7
Author: Arun Kumar Mohan <arunmohandm@gmail.com>
Date:   Tue Apr 28 19:39:44 2020 -0500

    Fix grammar (lynndylanhurley#1396)

commit ea697f1
Author: H.Sada <47932189+h-sada@users.noreply.github.com>
Date:   Wed Apr 29 09:39:27 2020 +0900

    fixed not_email in ja.yml (lynndylanhurley#1395)

commit 275da3c
Author: Gabriel Bursztein <gabrielbursztein94@gmail.com>
Date:   Mon Mar 30 08:23:22 2020 -0300

    Fix: Save user authentication token after email confirmation (lynndylanhurley#1391)

commit 4a103ed
Author: Ahmed Magdy <ahmedmagdy711@users.noreply.github.com>
Date:   Mon Mar 30 13:19:16 2020 +0200

    Validate that token is valid for patch request last token (lynndylanhurley#1386)

commit 4d2d702
Author: Leo Kiiski <goalaleo@gmail.com>
Date:   Mon Mar 30 14:18:54 2020 +0300

    Fix token-type header key in testing example (lynndylanhurley#1390)

commit ab050c2
Author: Dylan Lederle-Ensign <dylan.lederle.ensign@gmail.com>
Date:   Mon Mar 30 07:17:57 2020 -0400

    Fix broken link (lynndylanhurley#1392)

commit 8c6ea5a
Author: Olle Jonsson <olle.jonsson@gmail.com>
Date:   Mon Mar 30 13:16:53 2020 +0200

    CI build fix: Pin to pry < 0.13 for 2.3 support, workaround CodeClimate reporter issue (lynndylanhurley#1393)

    * gemfiles: Pin to < 0.13 for 2.3 support

    * Workaround: CodeClimate not supporting SimpleCov

      - 0.18 gives us issues
      - see codeclimate/test-reporter#418

commit 49e7203
Author: K-Sato <32632542+K-Sato1995@users.noreply.github.com>
Date:   Sat Feb 29 08:17:59 2020 +0900

    Fix docs/usage/reset_password.md (lynndylanhurley#1382)

commit 55fcd11
Author: Bartek Fijałkowski <brateq@gmail.com>
Date:   Thu Jan 30 21:35:50 2020 +0100

    Add docs for confirmation endpoint (lynndylanhurley#1365)

commit e0d8dfa
Author: sugiken <ynmk1995@gmail.com>
Date:   Fri Jan 31 05:35:31 2020 +0900

    Remove Trackable option from generator (lynndylanhurley#1362)

commit 8326cc7
Author: Bartek Fijałkowski <brateq@gmail.com>
Date:   Thu Jan 30 21:33:45 2020 +0100

    Add rails 6.0 config to travis (lynndylanhurley#1366)

    * Add rails 6.0 config to travis

    * Exclude Travis Rails 6.0 checks for Ruby below 2.5

    * Updates tests to be compatible with Rails 6

    Rails 6 no longer generates migration with id: :uuid, so I changed the range of two ifs in tests and everything goes well now.

    * Add Ruby 2.7.0 to Travis

    * Exclude travis test for Ruby 2.7.0 with Rails 4.2

    Ruby 2.7 comes with Bundler 2 which is not compatible with Rails 4

    * Add to Travis test for rails 6 + mongoid 7

    * Downgrade mongoid-locker for rails 6 gemfile

    * Allow to change primary key type for Rails 6

commit 880a249
Author: Paweł Łuczak <woochaq@gmail.com>
Date:   Thu Jan 30 21:32:47 2020 +0100

    Fix missing polish and portugese translation errors (lynndylanhurley#1377)

commit 3680fd3
Author: Clément Prod'homme <prodhomme.clement@hotmail.fr>
Date:   Wed Jan 29 05:42:35 2020 +0100

    chore(docs): write complete path for authentication_test_spec (lynndylanhurley#1376)

commit 00d7abc
Author: Nicholas Martin <nicholas.martin@marketdojo.com>
Date:   Thu Jan 9 13:23:36 2020 +0000

    Add case sensitive option required to prevent deprecation warning in rails 6 (lynndylanhurley#1368)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants