-
Notifications
You must be signed in to change notification settings - Fork 219
feat(auth): Add Redis caching for pending user registration and implement token verification logic #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mantle-bearer
wants to merge
39
commits into
hngprojects:dev
Choose a base branch
from
mantle-bearer:feat/auth-caching-unverified-users
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(auth): Add Redis caching for pending user registration and implement token verification logic #1181
Changes from 21 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
eb8caaa
feat(auth): add Redis caching for unverified users and update environ…
mantle-bearer b2ac1d9
feat(deps): add Redis as a dependency for caching functionality
mantle-bearer 5d23275
feat(auth): restructure user data response and update token verificat…
mantle-bearer 1fc3140
feat(auth): add is_superadmin field to user registration and update v…
mantle-bearer 8159e95
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer c25ead2
feat(auth): update environment .env.sample
mantle-bearer 34c7c22
feat(env): update Redis configuration in .env.sample
mantle-bearer b96211e
feat(env): update email configuration in .env.sample
mantle-bearer 408c9bc
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer 4b41bb5
feat(test): add access token generation for user registration and enh…
mantle-bearer fe928da
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer 40bf937
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer 5529ccb
feat(auth): update test file
mantle-bearer 5a62d5d
refactor(test): clean up whitespace in super admin creation test
mantle-bearer 2233072
refactor(auth): remove merge conflict markers and clean up imports
mantle-bearer 3e0f3e3
feat(auth): add endpoints for setting up, enabling, and disabling TOT…
mantle-bearer 13100dd
feat(auth): verify 2FA status during user login process
mantle-bearer d0e3fc1
feat(config): update frontend URL and add configurable port number
mantle-bearer 9178487
feat(config): add configurable server port number to settings
mantle-bearer a4eafbd
feat(config): add server port number to .env.sample
mantle-bearer 201fc52
feat(config): update .env.sample with placeholder values for sensitiv…
mantle-bearer 446c2b8
refactor(user): remove unused create_registration_access_token method
mantle-bearer a827a66
refactor(redis): replace direct Redis client initialization with a la…
mantle-bearer e11634e
feat(config): update .env.sample with default Redis port and database…
mantle-bearer b75b182
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer 510f560
docs(auth): clarify comment on token generation in login function
mantle-bearer 9cdbfc1
refactor(auth): replace print statements with logger for token genera…
mantle-bearer d07c467
feat(ci): add Redis service configuration to CI workflow
mantle-bearer 6990985
feat(ci): update Redis service configuration in CI workflow
mantle-bearer 808514c
feat(ci): update Redis host and port in CI workflow
mantle-bearer b78ee6f
feat(ci): use secrets for Redis configuration in CI workflow
mantle-bearer 552996c
feat(ci): move Redis configuration to environment variables in CI wor…
mantle-bearer 6f06942
Merge branch 'dev' into feat/auth-caching-unverified-users
mantle-bearer c04ae03
feat(ci): update CI workflow to use secrets for Redis configuration a…
mantle-bearer 06ad020
feat(ci): add Redis service and environment variables for CI workflow
mantle-bearer 17025ae
feat(ci): remove unused Redis environment variables from CI workflow
mantle-bearer 7b457fc
test: mock Redis client in user registration tests
mantle-bearer 6410507
test: enhance Redis connection handling in user registration tests
mantle-bearer ef8aabc
test: update assertions in user creation tests to accommodate Redis h…
mantle-bearer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -8,21 +8,23 @@ DB_HOST="localhost" | |
| DB_PORT=5432 | ||
| MYSQL_DRIVER= | ||
| DB_URL=postgresql://username:password@localhost:5432/test | ||
| SECRET_KEY = "" | ||
| ALGORITHM = HS256 | ||
| ACCESS_TOKEN_EXPIRE_MINUTES = 3000 | ||
| SECRET_KEY="" | ||
| ALGORITHM=HS256 | ||
| ACCESS_TOKEN_EXPIRE_MINUTES=3000 | ||
| JWT_REFRESH_EXPIRY=7 | ||
| APP_URL= | ||
|
|
||
| GOOGLE_CLIENT_ID="" | ||
| GOOGLE_CLIENT_SECRET="" | ||
|
|
||
| FRONTEND_URL='http://127.0.0.1:3000/login-success' | ||
| FRONTEND_URL='https://python-fastapi.boilerplate.hng.tech' | ||
|
|
||
| SERVER_PORT_NUMBER=7001 | ||
|
|
||
| TESTING='' | ||
|
|
||
| MAIL_USERNAME="" | ||
| MAIL_PASSWORD="" | ||
| MAIL_USERNAME="MAIL_USERNAME" | ||
| MAIL_PASSWORD="MAIL_PASSWORD" | ||
| MAIL_FROM="[email protected]" | ||
| MAIL_PORT=465 | ||
| MAIL_SERVER="smtp.gmail.com" | ||
|
|
@@ -40,6 +42,14 @@ STRIPE_WEBHOOK_SECRET="" | |
| MAILJET_API_KEY='MAIL JET API KEY' | ||
| MAILJET_API_SECRET='SECRET KEY' | ||
|
|
||
|
|
||
| REDIS_HOST='REDIS_HOST' | ||
| REDIS_PORT='REDIS_PORT' | ||
| REDIS_PASSWORD='REDIS_PASSWORD' | ||
| REDIS_DB='REDIS_DB' | ||
|
|
||
| APP_NAME="fastapi_boilerplate" | ||
|
|
||
|
|
||
| TELEX_WEBHOOK_URL="" | ||
|
|
||
This file contains hidden or 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 hidden or 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,11 @@ | ||
| import redis | ||
| from api.utils.settings import settings | ||
|
|
||
| # Initialize Redis connection | ||
| redis_client = redis.StrictRedis( | ||
| host=settings.REDIS_HOST, | ||
| port=settings.REDIS_PORT, | ||
| password=settings.REDIS_PASSWORD, | ||
| db=settings.REDIS_DB, | ||
| decode_responses=True | ||
| ) | ||
mantle-bearer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.