Spaces:
Sleeping
Sleeping
Commit History
-
feat(auth): add password reset token to forgot-password flow
- Generate JWT-based reset token during OTP generation for password reset endpoint - Store reset token and creation timestamp in user security settings alongside OTP - Return reset token and expiry time in forgot-password response for client use - Update send_forgot_password_otp return type to include optional reset token - Enables secure password reset workflow with token validation after OTP verification86b2156
-
fix: robustly sync must_change_password into require_password_change on login; clear top-level must_change_password on password change/reset
37bf953 -
fix: sync must_change_password from scm_system_users into require_password_change on login
a5ad68d -
feat: store forgot-pwd OTP in MongoDB, support OTP-based login and reset-with-otp endpoint
b0e514f -
forget password flow
cc73d86 -
merchant name fix for OTP
a24aedc -
notfication ms integration
4e94087 -
OTP template
79d7b1c -
forgot pwd fix
d9fd805
-
role id fix
b81506c -
role id fix
f6063c4
-
notification fix
6cd783a -
email smtp
84651f3
-
feat(system-users): Add comprehensive authentication logging with emoji indicators
- Add info-level logging for user lookup attempts by email, phone, and username - Log successful user discovery with username, email, status, and role details - Add warning logs for locked accounts with unlock timestamp information - Add warning logs for inactive account status checks - Add info-level logging for password verification process with hash prefix - Add exception info to error logs for better debugging during auth failures - Improve authentication flow visibility for troubleshooting and security monitoring128268c
-
feat(staff-auth): Query pos_staff collection directly and add staff_id to auth tokens
- Replace SystemUserService dependency with direct pos_staff collection queries - Add staff_id field to JWT token payload and login response - Implement _get_staff_by_phone() helper to fetch staff from pos_staff with field normalization - Implement _get_merchant_type() helper to fetch merchant type from scm_merchants cross-DB - Add ADMIN_ROLES constant to prevent admin users from using staff OTP login - Update staff login response schema to include staff_id and normalize permissions field - Refactor staff_auth_service with organized sections for internal helpers and public API - Improve error handling and logging for staff lookup operations - Update collections.py to define POS_STAFF_COLLECTION constant - Enhance notification queue integration for OTP delivery via WhatsApp and SMS0ece69a -
feat(notifications): Replace WATI service with unified notification queue
- Replace direct WATI WhatsApp API calls with NotificationQueue abstraction across customer, service partner, and staff auth services - Add NotificationQueue utility module for centralized OTP notification handling via WhatsApp and SMS - Update OTP delivery status tracking to use "queued" and "queue_failed" states instead of "sent" and "failed" - Remove WatiService dependencies and instantiation from auth services - Simplify OTP response messages to be channel-agnostic - Add merchant_id lookup and passing to notification queue for credential resolution - Export NotificationQueue from utils module for consistent access across services2a952d3
-
feat(system-users): Add Pydantic config for field alias population
- Add Config class to CreateUserRequest schema with populate_by_name enabled - Allow schema to accept both field names and aliases during deserialization - Improve API flexibility for client integrations with different naming conventions690d338 -
feat(system-users): Add metadata support and enhanced user creation logging
- Add metadata field to SystemUserModel for storing additional user information (employee_user_id, employee_code, designation, etc.) - Add full_name field to CreateUserRequest schema with auto-generation from first_name and last_name - Add status field to CreateUserRequest schema with UserStatus.ACTIVE as default - Add metadata field to CreateUserRequest schema for flexible additional data - Add role_id alias to role field in CreateUserRequest for improved API compatibility - Enhance create_user service method with comprehensive debug logging at each step (username/email validation, user ID generation, password hashing, merchant type fetching, model creation, database insertion) - Implement full_name auto-generation logic when not explicitly provided - Add metadata propagation from request to stored user model - Improve observability with structured logging including correlation data (merchant_id, merchant_type, collection name)512572c
-
feat(auth): Add user management endpoints with admin controls
- Add POST /users endpoint to create new user accounts with validation - Add GET /users endpoint to list users with pagination and status filtering - Add POST /users/list endpoint with advanced filtering, projection, and MongoDB optimization - Add GET /users/{user_id} endpoint to retrieve individual user details - Add PUT /users/{user_id} endpoint to update user information and roles - Add DELETE /users/{user_id} endpoint to soft-delete users with audit logging - Add POST /users/{user_id}/change-password endpoint for user password changes - Add POST /users/forgot-password endpoint for password reset flow - Add POST /users/verify-reset-token endpoint to validate reset tokens - Add POST /users/reset-password endpoint to complete password reset - Add POST /users/{user_id}/status endpoint to manage user status (active/inactive/suspended) - Implement require_admin_role dependency for authorization on all user management endpoints - Add comprehensive input validation for all user operations …cd28adc -
refactor: Simplify SCM permission lookup by removing the intermediate role ID mapping.
cb5967b
-
(System_user)-updated last_login_at in change_password()
vanithae642846 -
(system_user)-fix change password. convert user_id UUID to str
vanitha1bb0782 -
(system_user)-fix change password. convert user_id UUID to str
vanitha2a9b97c
-
feat(auth): Implement staff mobile OTP login and restructure user management routes
622d307
-
fix(system_users): Add UUID serialization in JWT token creation
- Convert UUID objects to strings in create_access_token method for JSON serialization compatibility - Convert UUID objects to strings in create_refresh_token method for JSON serialization compatibility - Add validation loop to iterate through token data and convert any UUID instances to string format - Prevents JWT encoding errors when UUID objects are present in token payload datae9ff13c
-
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
vanitha017e331 -
changed user_id as UUID
vanitha5fdb9fd
-
feat(auth): Add backward compatibility for customer token type migration
- Update customer token validation to accept both "customer" and "access" token types - Allow "access" tokens with customer_id field for legacy token compatibility - Preserve custom token types during JWT encoding in SystemUserService - Only set default "type" to "access" if not already specified in token data - Enable smooth transition during token type migration without breaking existing tokensfacbc29
-
updates
e032470
-
feat(system_users): Complete staff mobile OTP login implementation with token generation
- Add necessary imports for datetime, logging, and service dependencies - Implement access token creation with configurable expiration from settings - Add token payload with user credentials (user_id, username, role, merchant details) - Convert user model to UserInfoResponse for response serialization - Return StaffMobileOTPLoginResponse with access token, token type, and expiration - Add login endpoint stub for standard authentication flow - Organize imports at module level for better code structure and maintainability7426dce -
fix(system_users): Reorganize router imports and definitions for proper initialization order
- Move router definition to top of file before any endpoint usage - Add missing FastAPI imports (APIRouter, Depends, HTTPException, status, Request) - Add HTTPAuthorizationCredentials import from fastapi.security - Remove duplicate router definition and imports from later in file - Clean up file structure to prevent router initialization issues - Ensure router is available for all endpoint decorators57100c8 -
fix: Correct type hint for user_info in StaffMobileOTPLoginResponse and adjust router definition placement
60b9eb5 -
feat: Implement staff mobile OTP login endpoint with validation and token generation
4fe4dba
-
feat: Implement password rotation policy with status checks and logging
ddaa9b3 -
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
fe3ac46 -
feat: Enhance logout functionality with audit logging and security improvements
92a0975
-
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
vanitha98f799f -
removed first_name and last_name added full_name
vanitha9ebd6b2 -
feat: Implement forgot password feature with email reset functionality
- Added `FORGOT_PASSWORD_QUICKSTART.md` for quick reference on setup and usage. - Created `IMPLEMENTATION_SUMMARY.md` detailing the implementation process and features. - Introduced new API endpoints for password reset: `/auth/forgot-password`, `/auth/verify-reset-token`, and `/auth/reset-password`. - Developed email service in `app/utils/email_service.py` for sending transactional emails. - Updated configuration in `app/core/config.py` to include password reset settings. - Enhanced user service in `app/system_users/services/service.py` to handle password reset token creation, verification, and email sending. - Added schemas for password reset requests in `app/system_users/schemas/schema.py`. - Implemented token storage and management in `app/system_users/models/model.py`. - Created a test script `test_forgot_password.py` to validate the complete password reset flow. - Included troubleshooting and security features in documentation.96e0270 -
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
vanithae4562cb -
added fullname and removed metdata from login response
vanitha6939a48 -
Implement structured logging system across AUTH Microservice
- Added JSONFormatter and StructuredLogger classes for structured logging. - Implemented setup_logging() and get_logger() functions for logging configuration. - Integrated structured logging into app/main.py, app/auth/controllers/router.py, app/system_users/controllers/router.py, app/dependencies/auth.py, app/nosql.py, app/cache.py, app/core/db_init.py, app/internal/router.py, and app/system_users/services/service.py. - Updated logging calls to include structured context and error handling. - Created comprehensive logging documentation (PRODUCTION_LOGGING_IMPLEMENTATION.md and PRODUCTION_LOGGING_SUMMARY.md) detailing logging architecture, usage, and best practices.755d6cd -
Enhance error handling and logging across authentication and user management endpoints
- Improved error handling in authentication dependencies to raise detailed HTTP exceptions for various failure scenarios. - Added logging for missing credentials, token verification failures, and database errors in authentication processes. - Enhanced user creation endpoints with validation checks for required fields and improved error responses. - Implemented detailed logging for user management actions, including creation, updates, and deactivation. - Added request logging middleware to track incoming requests and their processing times. - Standardized error responses for validation errors and database issues throughout the application. - Improved health check and database status endpoints with better error handling and logging.2d38c65
-
docs(merchant_type): Standardize merchant type references to lowercase
- Update MERCHANT_TYPE_IMPLEMENTATION.md to use lowercase `ncnf` instead of `NCNF` - Update model field descriptions in SystemUserModel to reference lowercase merchant types - Update schema field descriptions in CreateUserRequest to reference lowercase merchant types - Update router endpoint documentation to reference lowercase merchant types - Update initial user creation script to use lowercase `ncnf` for merchant_type values - Update demo script to use lowercase `ncnf` in merchant type filtering - Update test script to use lowercase `ncnf` in merchant type filtering - Ensures consistency across all merchant type references throughout the codebased74c068 -
docs(merchant_type): Update merchant type references from salon to retail and NCNF
- Update supported merchant types documentation from `national_cnf`, `cnf`, `distributor`, `salon` to `NCNF`, `cnf`, `distributor`, `retail` - Replace all `salon` references with `retail` across documentation and example code - Update role mapping from `role_salon_owner` to `role_retail_owner` in SCM permissions integration - Update example payloads and API documentation to use retail merchant type - Update model field descriptions and schema examples to reflect new merchant type values - Update test data and demo scripts to use retail instead of salon - Standardize merchant type naming conventions across all internal schemas and API endpoints349a6d0
-
feat(system_users): Add merchant_type field to user update schema and create utility scripts
- Add merchant_type optional field to UpdateUserRequest schema for updating user merchant type - Create check_user_merchant_type.py script to verify if users have merchant_type set in database - Create fix_user_merchant_type.py script to update user merchant_type from merchant service - Create placeholder create_missing_user.py script for future user creation utility - Enable merchant_type updates through the user update endpoint to support merchant type management87ec4dd
-
feat(internal): Add internal API endpoints for system user creation from employees and merchants
- Create new internal API module with router and schemas for system user creation - Add `/internal/system-users/from-employee` endpoint for SCM service to create users from employee data - Add `/internal/system-users/from-merchant` endpoint for SCM service to create users from merchant data - Implement automatic username and password generation when not provided - Add metadata tracking for user creation source and origin (employee/merchant) - Update system user service to support internal API user creation with "system_internal" creator - Add migration script to update existing system users with merchant_type field - Include comprehensive logging for internal user creation operations - These endpoints enable seamless system user provisioning from external microservices (SCM, POS)5f1560e
-
refactor(models): make first_name optional in SystemUserModel
To align with the optional nature of last_name and phone fields, first_name is now also optional. This provides more flexibility when creating user records where first name might not be required.d990a6b
-
refactor(schemas): update imports and fix newline in schema file
390c48c -
feat(system_users): Add merchant_type field and list endpoint with projection support
- Add `merchant_type` field to SystemUserModel for merchant categorization - Implement automatic merchant_type detection from SCM service during user creation - Add optional `merchant_type` parameter to CreateUserRequest schema - Include `merchant_type` and `merchant_id` in UserInfoResponse schema - Create new `POST /auth/users/list` endpoint with projection support following API standards - Implement `list_users_with_projection()` service method with filtering by merchant_type, role, status, and merchant_id - Add `get_merchant_info()` service method to fetch merchant data from SCM service with fallback to database - Create comprehensive documentation in MERCHANT_TYPE_IMPLEMENTATION.md with usage examples and benefits - Add test script `test_system_users_with_merchant_type.py` for API validation - Add demo script `demo_merchant_type_users.py` for interactive testing - Update `create_initial_users.py` to support merchant_type initialization - Enable 50-90% response size reduction throug…a581666