feat(auth): Add Redis caching for pending user registration and implement token verification logic#1181
Open
mantle-bearer wants to merge 39 commits intohngprojects:devfrom
Open
Conversation
…ment configuration
…erification responses
Signed-off-by: Mantle Bearer <64046366+mantle-bearer@users.noreply.github.com>
Signed-off-by: Mantle Bearer <64046366+mantle-bearer@users.noreply.github.com>
Signed-off-by: Mantle Bearer <64046366+mantle-bearer@users.noreply.github.com>
…ance verification flow
Signed-off-by: Mantle Bearer <64046366+mantle-bearer@users.noreply.github.com>
Signed-off-by: Mantle Bearer <64046366+mantle-bearer@users.noreply.github.com>
samuelogboye
requested changes
Mar 1, 2025
Contributor
|
This might break prod if redis is not set up in other environments |
mantle-bearer
commented
Mar 2, 2025
Author
mantle-bearer
left a comment
There was a problem hiding this comment.
I have resolved all the conversation as requested.
Here are the commit messages for you to quickly confirm and approve my PR
-
No longer exposing sensitive credentials in .env.sample 201fc52e74c94951084160b74a95e516b3b0a824
-
I have removed the unused create_registration_access_toke() method in this commit 446c2b85c902bf5438c69cb5d5f7a37c5f1f32b1
-
I replaced the direct Redis client initialization with a lazy-initialization approach
a827a66ac155ec7460f4f925442009ec5b5bea1f
…nd streamline app execution
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add Unit and Integration Tests for Authentication Routes
Description
This PR adds unit tests for the
/registerand/register-super-adminroutes and integration tests for the/verify-tokenroute. It also includes a mocked Redis client to simulate pending user cache during the verification process.Related Issue (Link to issue ticket) #1010
Motivation and Context
/registerand/register-super-adminroutes handle user and admin registration correctly./verify-tokenroute processes cached user data from Redis and creates user records in the database.How Has This Been Tested?
/register)/register-super-admin)/verify-token)Screenshots (if appropriate):
Successful user email sent to user
✅ Verification token match (valid token)

❌ Verification token mismatch (invalid token)
Redis CLI output displaying cached user data for both verified and after unverified user

All three tests passed

Types of changes
Checklist: