mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Rework the documentation
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
# Helpers
|
||||
|
||||
**FastAPI Users** provides some helper functions to perform some actions programmatically. They are available from your `FastAPIUsers` instance.
|
||||
|
||||
## Create user
|
||||
|
||||
Create a user.
|
||||
|
||||
```py
|
||||
regular_user = await fastapi_users.create_user(
|
||||
UserCreate(
|
||||
email="king.arthur@camelot.bt",
|
||||
password="guinevere",
|
||||
)
|
||||
)
|
||||
|
||||
superuser = await fastapi_users.create_user(
|
||||
UserCreate(
|
||||
email="king.arthur@camelot.bt",
|
||||
password="guinevere",
|
||||
is_superuser=True,
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
## Verify user
|
||||
|
||||
Verify a user.
|
||||
|
||||
```py
|
||||
verified_user = await fastapi_users.verify_user(non_verified_user)
|
||||
assert verified_user.is_verified is True
|
||||
```
|
||||
|
||||
## Get user
|
||||
|
||||
Retrieve a user by e-mail.
|
||||
|
||||
```py
|
||||
user = await fastapi_users.get_user("king.arthur@camelot.bt")
|
||||
```
|
||||
Reference in New Issue
Block a user