deseasion.backend.models.user module
- class deseasion.backend.models.user.User(username, email, password=None)
Bases:
ModelMixin
,Model
Represents a user
- check_password(password)
Check if the password is correct
- check_refresh_token(refresh_token)
Checks if the refresh is saved in the database for the current user.
WARNING: Does not check the validity of the token, checks only if it exists for the current user
- Args:
refresh_token - the token to check. Can be a str or a bytes object
- create_jwt()
Create a JSON Web Token for this user
- create_refresh_token()
Creates a JSON refresh token, and associates it to the user
- email
- classmethod get_by_email(email)
- classmethod get_by_username(username)
- classmethod get_from_jwt(token)
- classmethod get_from_refresh_token(token)
- id
- password_hash
- permissions
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- set_password(password)
Set the password_hash from the given password
- tokens
- username