21 Commits

Author SHA1 Message Date
45354ee9f0 Use default_factory in model for UUID4 generation 2021-08-29 15:35:56 +02:00
66d7c76a89 Fix BaseUserDB typing by making email, is_active, is_superuser and is_verified non optional 2021-03-08 17:07:07 +01:00
373157c284 Finalize user activation feature (#439)
* Add routes for user activation (#403)

* Add routes for user activation

Generate a token after creating the user in register route, passing to `activation_callback`, if `activation_callback` supplied
Create new `/activate` route that will verify the token and activate the user
Add new error codes to `fastapi_users/router/common.py`
Update documentation
Add tests

Co-authored-by: Mark Todd <markpeter.todd@hotmail.co.uk>

* Rework routes for user activation

* Separate verification logic and token generation into `/fastapi_users/router/verify.py`, with per-route callbacks for custom behaviour

* Return register router to original state

* Added `is_verified` property to user models

* Added `requires_verification` argument to `get_users_router`and `get_auth_router`

* Additional dependencies added for verification in `fastapi_users/authentication/__init__.py`

* Update tests for new behaviour

* Update `README.md` to describe a workaround for possible problems during testing, by exceeding ulimit file descriptor limit

Co-authored-by: Mark Todd <markpeter.todd@hotmail.co.uk>

* Restored docs to original state.

* All other modifications reqested added

Kebab-case on request-verify-token
SECRET now used as test string
Other minor changes

Co-authored-by: Mark Todd <markpeter.todd@hotmail.co.uk>

* Embed token in body in verify route

* Reorganize checks in verify route and add unit test

* Ignore coverage on Protocol classes

* Tweak verify_user function to take full user in parameter

* Improve unit tests structure regarding parametrized test client

* Make after_verification_request optional to be more consistent with other routers

* Tweak status codes on verify routes

* Write documentation for verification feature

* Add not released warning on verify docs

Co-authored-by: Edd Salkield <edd@salkield.uk>
Co-authored-by: Mark Todd <markpeter.todd@hotmail.co.uk>
2021-01-12 10:44:42 +01:00
7cf7154e27 Fix #431: make OAuth expires_at optional in model and DB schemas 2020-12-28 08:59:27 +01:00
435f29331a Fix #391: put user creation logic in a importable function 2020-11-22 09:57:03 +01:00
efad0e0fef fix "Swagger issue for endpoints register & update" (#233)
* fix: Change on the inheritance model, according to the documentation for the request body parameters. #171

* fix: Changes on the documentation examples to fix the inheritance problem when passing the User class (for create or update only passing the pydantic one) #171

* fix: Changes on the documentation examples to fix the inheritance problem when passing the User class (for create or update only passing the pydantic one) #171

* Put back inheritance on update model and factorize create_update_dict methods

Co-authored-by: François Voron <fvoron@gmail.com>
2020-06-27 17:19:53 +02:00
0a0dcadfdc Use real UUID for User id. and OAuthAccount id. (#198)
* Use UUID for user id and oauth account id

* Update documentation for UUID

* Tweak GUID definition of SQLAlchemy to match Tortoise ORM one

* Write migration doc
2020-05-21 16:40:33 +02:00
88b133d41c Implement OAuth2 flow (#88)
* Move users router in sub-module

* Factorize UserRouter into EventHandlersRouter

* Implement OAuth registration/login router

* Apply isort/black

* Remove temporary pytest marker

* Fix httpx-oauth version in lock file

* Ensure ON_AFTER_REGISTER event is triggered on OAuth registration

* Add API on FastAPIUsers to generate an OAuth router

* Improve test coverage of FastAPIUsers

* Small fixes

* Write the OAuth documentation

* Fix SQL unit-tests by avoiding collisions in SQLite db files
2020-01-17 11:43:17 +01:00
104a6c6bf5 Inject every models variations and DB model in DB adapters (#84)
* Inject every model variations in router and DB model in DB adapters

* Update documentation and import Tortoise in db module

* Use path operation decorator dependencies for superuser routes
2020-01-04 15:36:34 +01:00
b5b0bbbb01 Tortoise ORM support (#59)
* add tortoise to dependencies

* add tortoise as optional dependency in pyproject.toml

* add tortoise support (tests needed)

* Add tortoise support (also defined orm_mode in pydantic model

* tests for tortoise support

* format by black

* docs for tortoise

* delete type annotations

* delete underscore

* do it in 1 line

* add 1 line before yield

* fix in docs

* fix bug and add annotation for test

* Tweak documentation and fix Tortoise error about id update

* Improve Tortoise coverage by using get instead of filter

* Fix Pipfile.lock
2019-12-03 21:24:27 +01:00
59b8f144d7 Bump fastapi from 0.43.0 to 0.44.0 (#63)
* Bump fastapi from 0.43.0 to 0.44.0

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.43.0 to 0.44.0.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Changelog](https://github.com/tiangolo/fastapi/blob/master/docs/history-design-future.md)
- [Commits](https://github.com/tiangolo/fastapi/compare/0.43.0...0.44.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix breaking changes and depreciation following fastapi 0.44.0

* Bump fastapi==0.44.0 in pyproject.toml
2019-11-28 07:33:38 +01:00
9b7ec58800 #21: Add superuser routes (#30)
* Add CRU superuser routes

* Add delete method on DB adapters

* Add superuser delete route

* Add superuser routes documentation

* Pass black formatter
2019-10-29 13:32:44 +01:00
e146e4bca4 Fix #13: add /me update route 2019-10-20 10:11:48 +02:00
9e1fd76f30 Add more docstrings 2019-10-10 19:03:52 +02:00
0112e700ac Improve typing and make User pydantic models dynamic 2019-10-10 13:37:52 +02:00
d781a41872 Install Black formatter 2019-10-09 16:52:06 +02:00
20bb285f03 Use built-in OAuth2PasswordRequestForm for login 2019-10-06 14:02:42 +02:00
a81b438ec9 Implement authentication mechanism 2019-10-06 11:53:42 +02:00
bcc88a8b14 Implement working SQLAlchemy DB adapter 2019-10-06 11:00:24 +02:00
552f313d76 Add database abstraction 2019-10-06 08:53:13 +02:00
4e0b0f6f7d Start foundations 2019-10-05 17:39:37 +02:00