-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #253, Added 2fa columns to t_users
- Loading branch information
Showing
4 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
teraserver/python/alembic/versions/89343f5c95b9_allow_2fa_login.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""allow 2fa login | ||
Revision ID: 89343f5c95b9 | ||
Revises: 09764faa2d57 | ||
Create Date: 2024-09-05 14:49:04.781595 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '89343f5c95b9' | ||
down_revision = '09764faa2d57' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Add 2fa_enabled column to t_users table | ||
op.add_column(table_name='t_users', column=sa.Column('user_2fa_enabled', | ||
sa.Boolean, nullable=False, server_default=str(False))) | ||
|
||
# Add 2fa_otp_enabled column to t_users table | ||
op.add_column(table_name='t_users', column=sa.Column('user_2fa_otp_enabled', | ||
sa.Boolean, nullable=False, server_default=str(False))) | ||
|
||
# Add 2fa_email_enabled_column to t_users table | ||
# Will user user_email as 2fa email | ||
op.add_column(table_name='t_users', column=sa.Column('user_2fa_email_enabled', | ||
sa.Boolean, nullable=False, server_default=str(False))) | ||
|
||
# Add 2fa_otp_secret column to t_users table | ||
# Secrets will be generated with pytop.random_base32() | ||
op.add_column(table_name='t_users', column=sa.Column('user_2fa_otp_secret', | ||
sa.String(32), nullable=True)) | ||
|
||
# Add a force_password_change column to t_users table | ||
op.add_column(table_name='t_users', column=sa.Column('user_force_password_change', | ||
sa.Boolean, nullable=False, server_default=str(False))) | ||
|
||
|
||
def downgrade(): | ||
# Remove columns | ||
op.drop_column('t_users', 'user_2fa_enabled') | ||
op.drop_column('t_users', 'user_2fa_otp_enabled') | ||
op.drop_column('t_users', 'user_2fa_email_enabled') | ||
op.drop_column('t_users', 'user_2fa_otp_secret') | ||
op.drop_column('t_users', 'user_force_password_change') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters