This repository was archived by the owner on Jan 1, 2026. It is now read-only.
Secure registration and add login with and without OTP#7
Merged
Conversation
added 13 commits
June 9, 2025 14:19
…itize username input
…ring_utils and remove username.py
…mprove code structure
…nguage_id in User model and registration schema for consistency
…ing change label in version bump workflow
…ty and maintainability
…w fixtures and tests for email and phone encryption, hashing, and verification token generation.
…or verification logic
…directly and remove utility functions for versioned requests.
…oints; add utility functions for token creation and hashing.
… add payload generation fixtures for login and OTP tests
…and remove unnecessary fields from login payloads in schemas and tests.
…cessary parameters.
…t for improved clarity and reusability.
…of old session and refresh tokens
…ts to remove user_id assertions
…ng of dependencies
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This pull request introduces significant improvements to the user authentication and registration system. The registration flow now enforces email verification before user creation and supports 2FA (OTP). Various code enhancements were made for clarity, consistency, and maintainability.
Changes Made
UserCreateschema withUserRegisterfor clarity and alignment with the new flow.sanitize_usernametostring_utilsand removedusername.py.HTTPExceptionhandling for existing users during registration.language_idtolanguage_iso_codein theUsermodel for clarity.language_iso_codetolanguage_idin model and schema for consistency.echo=False,pool_pre_ping=True).How to Test
Checklist
Additional Context
These updates are foundational for enforcing stronger security in the authentication process, including email verification and 2FA. The code has been refactored to improve modularity and clarity, especially in schema and utility functions.