Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Create user registration over API #26

Merged
merged 3 commits into from
Mar 31, 2019
Merged

Conversation

mcab
Copy link
Owner

@mcab mcab commented Mar 27, 2019

Closes #11.

Adds user registration / login / logout to the application.

@mcab mcab changed the title Create User Registration WIP: Create User Registration Mar 27, 2019
@mcab
Copy link
Owner Author

mcab commented Mar 27, 2019

This still needs to be worked on:

  • Modify routes to only include those that we need (Disable RootView sunscrapers/djoser#179)
    • Disable set_username/user-change-username (we technically don't use them, we'll be using email / social logins)
    • Disable root/api-root
    • Disable user-list
  • Refactor authentication to be in its own file (probably under /apps/api/auth.py)
  • Test...
    • user-activate/user-activate-resend
    • password-reset/password-reset-confirm
    • user-confirm/user-detail
    • Multiple logins to the same account

Possibly need to create our own User model to start tracking / waiting for certain inputs.

@mcab
Copy link
Owner Author

mcab commented Mar 27, 2019

Blocked by #27 at the moment.

@mcab mcab changed the title WIP: Create User Registration WIP: Create user registration over API Mar 27, 2019
@mcab
Copy link
Owner Author

mcab commented Mar 30, 2019

Since the schema is technically in flux, we want to have an MVP without data from #27, so we can focus on recording and displaying the House data in multiple places. So, not blocking, but we will still need to do the other tasks above.

@mcab
Copy link
Owner Author

mcab commented Mar 31, 2019

Disabling routes turned out to be pretty tricky.

The noted GH issue above let you include or exclude certain urls, but by using DefaultRouter from DRF, certain paths were expected to be there. Due to such, set_username would still be there even if the path was manually not included.

So, we had to create the paths from what was listed in the Djoser URL files. To generate the URL paths now, we couldn't rely on a DefaultRouter; that would include some extraneous paths (user-confim, user-detail) that we no longer needed. So, AuthView lists the specific named routes in urlpatterns for apps/api/auth.py, and generates the absolute URI from them based off of the reversed path, otherwise, we generate relative URLs.

Now, we can browse to /auth/ and see the possible options. It's possible we do not actually need this, or better yet, only include the endpoints that the current accessing user has permission to do, but that seems to be out of scope.


Testing has fallen out of scope for this PR; the methods happen to do what they're intended for (activate, password-reset), while some (user-confirm, user-detail) were aliased paths to other locations.

@mcab mcab changed the title WIP: Create user registration over API Create user registration over API Mar 31, 2019
@mcab mcab merged commit 26f73e7 into develop Mar 31, 2019
@mcab mcab deleted the 11-create-user-registration branch March 31, 2019 00:32
mcab added a commit that referenced this pull request May 9, 2019
This change exposes authentication URLs underneath `/auth/` for the
application, borrowing on Djoser as a template. A custom view was
created in order to show the paths for authentication.

tox.ini was modified in order to force the environment to be rebuilt
if any of the requirements changed, in both base.txt or development.txt.
It so happened that since development did not change while base did, 
the environment had to be force remade to query the new dependencies.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant