This repository was archived by the owner on Jan 1, 2026. It is now read-only.
generated from Vianpyro/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Secure registration and add login and 2FA #5
Merged
Conversation
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
…register_user functions
…, email, or phone
…e schema constraints for user and language tables
…plify user insertion logic; delete obsolete authentication test file.
…g, running, and managing Docker containers; improve formatting for better readability.
…; update users table to enforce discriminator constraint and add pending_users table for email verification
…ete authenticate_user function, enhance is_email_available function, and implement procedures for creating and managing pending users.
… in register_user procedure, update authentication methods to include HOTP, and implement verification token validity check with a 24-hour constraint.
…on_method type usage and improve readability in test queries
…ved linting support
…ons for improved linting
b4ca1e2 to
d65070c
Compare
…ry in postAttachCommand and format dependencies for clarity
…ion and refresh tokens
…update last login and updated timestamps, and create triggers for automatic timestamp updates.
…d create_user_refresh_token to expire old tokens and insert new ones, and remove obsolete end_user_session procedures.
…nd tests for pending_users management
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
complexity: complex
Tasks with unclear paths that need exploration or experimentation.
priority: high
Important tasks that require immediate attention.
special: breaking change
Tasks that will introduce a breaking change and require careful implementation.
status: completed
Fully implemented and verified.
type: feature
Requests for new functionality or features.
type: refactor
Improvements to existing code without changing functionality.
type: security
Issues or improvements related to app security.
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 several major improvements to the database schema and stored procedures related to user authentication and registration. It adds support for email verification, improves data integrity with better constraints, supports OTP (2FA), and simplifies logic for maintainability.
Changes Made
register_userprocedure and updated schema for stricter username validation.VARCHARtoTEXTinauthenticate_userandregister_userfunctions for consistency.register_userprocedure to align with schema expectations.is_user_availablefunction to check for existing users by email.register_userto acceptlanguage_iddirectly and improved schema constraints onusersandlanguagestables.register_userby removing exception handling and streamlining user insertion logic.password_hashformat using a constraint for Argon2id compliance.is_user_availabletois_email_availablefor clarity and createdpending_userstable to support email confirmation workflow.is_email_availablewith updated logic to check across bothusersandpending_users.authenticate_user, improvedis_email_available, and added stored procedures for handling pending users.register_user, added support for HOTP in login flow, and enforced 24-hour expiration on email verification tokens.How to Test
pending_usersand a token is generated.userstable.Checklist
Additional Context
This update enables a more secure and structured user onboarding process. It enforces best practices like unique pending registrations, hash validation, email confirmation delays, and support for OTP-based two-factor authentication, while simplifying stored procedures and constraints for better maintainability.