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 -
required change password
e419180
-
role id fix
b81506c -
role id fix
f6063c4
-
notification fix
6cd783a -
notification
e47349e -
email smtp
84651f3 -
wati removed
3b3b885 -
feat(logging): Enhance logging with structured events and error handling
17ba139
-
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
-
refactor(cache): Improve Redis connection pool configuration handling
- Extract connection pool parameters into a dictionary for better maintainability - Add conditional password parameter to avoid passing None to Redis client - Enhance logging with host and port information for better debugging - Simplify pool initialization by using dictionary unpackingf9e7162 -
perf(cache): Implement Redis connection pooling with health checks
- Replace direct Redis client initialization with ConnectionPool for better resource management - Add connection pool configuration with max_connections=10 to limit concurrent connections - Enable socket keepalive to maintain persistent connections and detect stale connections - Set socket_connect_timeout to 5 seconds for faster failure detection - Enable retry_on_timeout to handle transient network issues gracefully - Add health_check_interval=30 for periodic connection validation - Update docstring to reflect connection pooling implementation - Add info-level logging when Redis client is initialized with pool configuration - Improves performance and reliability by reusing connections and preventing connection exhaustion9a8cccf
-
refactor(auth): Rename service_professional files to service_partners
- Rename service_professional_router.py to service_partners_router.py - Rename service_professional_auth.py to service_partners_auth.py - Rename service_professional_auth_service.py to service_partners_auth_service.py - Align file naming with existing service_partners terminology across codebasecb893ce
-
refactor(service-professional): Rename service_professional to service_partners throughout codebase
- Update user_type field from "service_professional" to "service_partners" in JWT token payload - Rename service_professional_auth_service.py to service_partners_auth_service.py - Rename service_professional_auth.py schema to service_partners_auth.py - Rename service_professional_router.py to service_partners_router.py - Update all import statements to reference renamed service modules - Rename endpoint functions from send_service_professional_otp to send_service_partners_otp - Rename endpoint functions from verify_service_professional_otp to verify_service_partners_otp - Update documentation files to reflect service_partners naming convention - Update sample data file references from service_professionals to service_partnerss - Update Redis cache key patterns from service_professional_otp to service_partners_otp - Update log event names from service_professional_* to service_partners_* - Align naming with MongoDB collection scm_service_partners for consistency9c25e38 -
refactor(service-professional): Rename collection from scm_service_professionals to scm_service_partners
- Update MongoDB collection reference in ServiceProfessionalAuthService from scm_service_professionals to scm_service_partners - Update collection name in service_professional_router.py documentation - Update all references in SERVICE_PROFESSIONAL_AUTH_GUIDE.md including mongoimport command, MongoDB shell queries, and troubleshooting section - Align collection naming with partner_id identifier migration completed in previous commits1e7f907 -
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 -
feat(logging): Add correlation ID tracing for distributed request tracking
- Add CorrelationIdMiddleware to extract/generate and propagate correlation IDs across requests - Implement CorrelationIdFilter in logging system to include correlation ID in all log records - Create CorrelationHttpClient utility for automatic correlation ID propagation to downstream services - Update main.py to register correlation ID middleware in request pipeline - Add comprehensive implementation guide documenting usage, tracing, and integration patterns - Enable request tracing across microservices for improved debugging and observability1f7d0a1 -
refactor: Simplify SCM permission lookup by removing the intermediate role ID mapping.
cb5967b
-
feat(auth): Add missing JWT token fields for microservice compatibility
- Add username field to service professional and customer tokens (required by TokenUser model) - Add role field to both token types for authorization in consuming microservices - Add phone and email fields to service professional tokens as fallbacks for username - Add phone and email fields to customer tokens for contact information - Update service_professional_auth_service.py create_professional_token() method - Update customer_token_service.py create_customer_token() method - Add JWT_TOKEN_FIELDS_FIX_SUMMARY.md documentation with token structure examples and testing procedures - Fixes authentication failures in downstream microservices (SPA, eCommerce, POS) caused by missing required token fieldsb57206e -
fix(auth): Remove hardcoded /auth prefix from router
- Remove redundant /auth prefix from APIRouter configuration - Prefix routing is now handled at application level for better modularity - Simplifies router definition and prevents duplicate path segments0fd5692
-
docs(service-professional): Update API endpoints and JWT payload documentation
- Change endpoint prefix from `/service-professional` to `/service-professionals` for consistency - Update all API endpoint examples in documentation (send-otp, verify-otp, logout) - Remove `staff_id` and `staff_code` from OTP login response documentation - Remove `merchant_id` from professional_info response object - Update JWT token payload documentation to reflect `partner_id` instead of `staff_id` and `staff_code` - Update curl and Python example requests with new endpoint paths - Align documentation with recent authentication system migration to partner_id identifiera0ecd9a -
feat(service-professional): Remove staff_id/staff_code from OTP login response
- Replace staff_id and staff_code fields with partner_id in professional info response - Update error logging to use partner_id instead of staff_id - Update login event logging to use partner_id as the standard identifier - Remove duplicate partner_id entry in JWT token payload - Consolidate identifier usage across OTP verification flow for consistency2ca6cd8 -
feat(service-professional): Migrate from staff_id/staff_code to partner_id identifier
- Replace staff_id and staff_code references with partner_id throughout authentication flow - Update OTP data storage in Redis to use partner_id instead of dual identifiers - Simplify JWT token payload to use partner_id as standard identifier - Remove redundant staff_code logging statements for cleaner logs - Consolidate professional identifier to single partner_id field for consistency - Maintain backward compatibility in token payload structure26d5826
-
feat(service-professional): Add staff_id to JWT token payload
- Include staff_id claim in JWT token payload for service professionals - Required by SPA-MS auth dependency for proper token validation - Ensures downstream services can extract staff_id without additional lookupsd87c960
-
chore(.gitignore): Add .env file to gitignore
- Add .env to gitignore to prevent accidental commits of environment variables - Ensures sensitive configuration and credentials are not tracked in version controled6a9cc
-
feat(service-professional): Add OTP-based authentication system for service professionals
- Add service professional authentication schema with phone and OTP validation models - Implement service professional auth service with OTP generation, verification, and JWT token creation - Create service professional router with send-otp, verify-otp, and logout endpoints - Integrate WhatsApp OTP delivery via WATI for secure authentication - Add comprehensive authentication guide with API documentation, setup instructions, and test data - Register service professional routes in main application - Support merchant context in JWT tokens for multi-tenant access control19a1450 -
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
846cbb0
-
feat(wati): Add employee credentials delivery via WhatsApp
- Add send_employee_credentials method to deliver login credentials via WATI WhatsApp API - Implement opt-in verification before sending credentials (with skip option) - Validate WATI access token configuration and handle missing credentials gracefully - Parse and validate WATI API response including receiver status and WhatsApp number validity - Add comprehensive error handling for timeout, network, and API errors with specific status codes - Include detailed logging for successful sends and failure scenarios - Support template-based message delivery with employee name, username, and password parameters4a7f89c -
feat(wati): Add WhatsApp opt-in verification and employee onboarding guide
- Add check_contact_opt_in method to verify contact opt-in status before sending messages - Implement skip_opt_in_check parameter in send_otp to allow bypassing opt-in validation - Add opt-in check before sending OTP with appropriate warning logging - Create comprehensive WHATSAPP_OPT_IN_GUIDE.md documenting opt-in requirements and workflows - Add check_whatsapp_optin.py debug script for testing contact opt-in status - Fix missing method definition for _get_headers in wati_service.py - Improve error handling and logging for WhatsApp message delivery failures89cbb84
-
(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
-
Merge branch 'main' of https://huggingface.co/spaces/cuatrolabs/cuatrolabs-auth-ms
vanithabe86e8d
-
feat(wati): Enhance token handling and error logging for WATI API integration
8f49572 -
fix(logging): Enhance JSONFormatter to handle non-serializable values
5837d2b
-
fix(logging): Ensure JSON serialization handles non-serializable types
7bfb479 -
Create .env
Verified signature6dd4819 -
docker
b2a1ec2