-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 2FA logic improving use flow
- Loading branch information
1 parent
603e6a4
commit 8d064e3
Showing
7 changed files
with
123 additions
and
60 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
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
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,12 @@ | ||
# -*- coding: utf-8 -*- | ||
from tortoise import BaseDBAsyncClient | ||
|
||
|
||
async def upgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" ADD "is_2fa_enabled" BOOL NOT NULL DEFAULT False;""" | ||
|
||
|
||
async def downgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" DROP COLUMN "is_2fa_enabled";""" |
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,12 @@ | ||
# -*- coding: utf-8 -*- | ||
from tortoise import BaseDBAsyncClient | ||
|
||
|
||
async def upgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" ADD "is_2fa_active" BOOL NOT NULL DEFAULT False;""" | ||
|
||
|
||
async def downgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" DROP COLUMN "is_2fa_active";""" |
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,16 @@ | ||
# -*- coding: utf-8 -*- | ||
from tortoise import BaseDBAsyncClient | ||
|
||
|
||
async def upgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_enabled" TO "is_2fa_required"; | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_active" TO "is_2fa_activated";""" | ||
|
||
|
||
async def downgrade(db: BaseDBAsyncClient) -> str: | ||
return """ | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_required" TO "is_2fa_active"; | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_activated" TO "is_2fa_active"; | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_required" TO "is_2fa_enabled"; | ||
ALTER TABLE "user" RENAME COLUMN "is_2fa_activated" TO "is_2fa_enabled";""" |