JWT token size

This commit is contained in:
Emmanuel Viennet 2021-12-20 22:50:14 +01:00
parent 8059e1622f
commit 8532ab5134
2 changed files with 41 additions and 1 deletions

View File

@ -65,7 +65,7 @@ class User(UserMixin, db.Model):
date_created = db.Column(db.DateTime, default=datetime.utcnow)
date_expiration = db.Column(db.DateTime, default=None)
passwd_temp = db.Column(db.Boolean, default=False)
token = db.Column(db.String(32), index=True, unique=True)
token = db.Column(db.Text(), index=True, unique=True)
token_expiration = db.Column(db.DateTime)
roles = db.relationship("Role", secondary="user_role", viewonly=True)

View File

@ -0,0 +1,40 @@
"""user token size limit
Revision ID: 91be8a06d423
Revises: 4f98a8b02c89
Create Date: 2021-12-20 22:48:42.390743
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "91be8a06d423"
down_revision = "4f98a8b02c89"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"user",
"token",
existing_type=sa.VARCHAR(length=32),
type_=sa.Text(),
existing_nullable=True,
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"user",
"token",
existing_type=sa.Text(),
type_=sa.VARCHAR(length=32),
existing_nullable=True,
)
# ### end Alembic commands ###