33 Commits

Author SHA1 Message Date
fe932fee19 Add request parameter to delete user method (#1258)
* add request parameter to delete_user method.

* Docs: Add request parameter to docstring
2023-07-26 13:10:03 +02:00
8fd097cbc8 Revamp Transport so they always build a full Response object (#1049)
* Revamp Transport so they always build a full Response object

* Fix linting

* Add private methods to set cookies on CookieTransport

* Change on_after_login login_return parameter to response
2023-04-27 09:32:49 +02:00
4e426d6823 Add login_return to on_after_login method (#1187) 2023-04-14 16:10:22 +02:00
9b57fa2e73 Allow to set is_verified to True after OAuth callback 2023-02-13 17:42:31 +01:00
5c48283155 Update docs for SQLAlchemy 2.0 2023-02-13 17:28:49 +01:00
b18389439a Use "sub" claim instead of "user_id" for JWT, verify and reset password tokens 2023-01-16 11:44:42 +01:00
794133c4fe Ensure reset password token is single use 2023-01-16 11:38:49 +01:00
7ad5f8073d on_after_login hook (#1092)
* on_after_login minimal impl.

Questions: is the spot logical for after method? Is after the internal login call.
Would before_login be needed? Maybe not, as auth is the way to do pre-login things.

Added fastapi request as a param just in case, as other callbacks had it too.

Docs addition is missing.

* tried to complete the implementation, but the test with user_manager.on_after_login.called fails though

* move on_after_login tests to right place, to TestLogin. These ones pass.

TODO: check TestCallback

* on_after_login tests to TestCallback too, for oauth. Apparently test_redirect_url_router fires the callback too, I guess that's correct, am not using oauth myself.

* fix formatting with make format

* docs for on_after_login

Co-authored-by: Toni Alatalo <toni.alatalo@gmail.com>
2022-10-18 08:02:01 +02:00
ce15284fe9 Implement a router to associate an OAuth account with an authenticated user 2022-06-20 14:44:25 +02:00
64d3996415 Add flag to enable/disable email association with OAuth 2022-06-20 13:46:47 +02:00
3bb3728261 add on delete hook (#1014)
Co-authored-by: Schwannden Kuo <schwannden@mobagel.com>
2022-06-20 13:26:02 +02:00
78be936297 Put exceptions in a dedicated module to avoid circular imports 2022-05-06 13:17:22 +02:00
72aa68c462 Native model and generic ID (#971)
* Use a generic Protocol model for User instead of Pydantic

* Remove UserDB Pydantic schema

* Harmonize schema variable naming to avoid confusions

* Revamp OAuth account model management

* Revamp AccessToken DB strategy to adopt generic model approach

* Make ID a generic instead of forcing UUIDs

* Improve generic typing

* Improve Strategy typing

* Tweak base DB typing

* Don't set Pydantic schemas on FastAPIUsers class: pass it directly on router creation

* Add IntegerIdMixin and export related classes

* Start to revamp doc for V10

* Revamp OAuth documentation

* Fix code highlights

* Write the 9.x.x ➡️ 10.x.x migration doc

* Fix pyproject.toml
2022-05-05 14:51:19 +02:00
18954cc7bd Add simple solution to update of oauth with more consistent use of identifiers (#953) 2022-04-21 11:06:21 +02:00
7f6d038d91 Create a class helper to let configure the password hasher dynamically 2022-03-22 14:16:49 +01:00
533504634f Improve dependencies typing 2022-01-15 11:08:49 +01:00
4d28d7d6ba Fix typo in manager.py (#791)
successfull -> successful
2021-11-07 13:24:51 +01:00
9eb49482c7 Users now become unverified when email is changed (#783)
* Users now become unverified when email is changed

Occurs when updating user.email to a new value

* changed wording
2021-11-07 10:04:06 +01:00
872b85de03 Code Expression (#1) (#767)
* Replace unused `for` index with underscore

* Use `items()` to directly unpack dictionary values

* Merge duplicate blocks in conditional

* Use `any()` instead of for loop

* Format __init__.py
2021-10-16 09:29:34 +02:00
b33371542f Fixed bug with custom reset token audience.
When adding a custom reset token audience, we still use the default one in the creation of the JWT token instead of the custom one.
2021-09-23 12:54:13 +03:00
ab06778adf Fix #733: don't raise error when updating user with same email 2021-09-20 08:49:19 +02:00
69f18cff47 Put user_db_model as attribute of UserManager 2021-09-17 11:24:49 +02:00
018771cf73 Add manager docstrings 2021-09-15 16:00:58 +02:00
de86456af2 Add some manager tests 2021-09-15 15:20:28 +02:00
5cba969679 Refactor verify logic into manager 2021-09-15 14:36:04 +02:00
3bdae94869 Refactor OAuth logic into manager 2021-09-15 11:57:17 +02:00
9673e0a5fd Move on_after_update to manager 2021-09-15 09:34:28 +02:00
663b7405a7 Move forgot/reset password logic to manager 2021-09-15 09:13:11 +02:00
38d4aed817 Move on_after_register to manager 2021-09-14 15:02:17 +02:00
8967138375 Inject a user manager dep callable directly to FastAPIUsers 2021-09-14 14:39:59 +02:00
480a6bc4df Move validate_password into UserManager 2021-09-14 14:01:57 +02:00
fdc8e54253 Improve generic typing 2021-09-14 11:53:43 +02:00
dade8c263d Revamp implementation with a manager layer and db class as dependency callable 2021-09-14 11:12:34 +02:00