POST /auth/createUser
Creates a new employee user account in the vLife DGO system. Validates that the username is unique, encrypts the password using bcrypt, and stores the user data in the database.Request Body
Employee’s full name (e.g., “Juan Pérez García”)
Employee’s RFC (Registro Federal de Contribuyentes) - Mexican tax ID
Desired username for the account. Must be unique in the system.
Plain text password. Will be hashed using bcrypt with 10 salt rounds.
Type of evaluation the employee is subject to (e.g., “PERMANENCIA”, “NUEVO INGRESO”)
Reason or motive for the evaluation request
Government department or dependency the employee belongs to
Employee’s gender (e.g., “M” for Masculino, “F” for Femenino)
Registration Flow
- System checks if username (
empUsuario) already exists - If unique, password is hashed using bcrypt:
- Algorithm: bcrypt
- Salt Rounds: 10
- User data is inserted into
cat_dgo_empleadostable - Flash success message displayed
- Redirects back to signup page
Success Response
On successful registration:- HTTP Status: 302 (Redirect)
- Location: Back to signup page (can now sign in)
- Flash Message: “Usuario guardado !”
- Database: New record created in
cat_dgo_empleados
Error Responses
When username already exists in the system
- Flash Message: “Este usuario ya existe !”
- Action: Redirects back to signup page
- HTTP Status: 302 (Redirect)
When database or bcrypt operation fails
- Action: Error logged to console
- HTTP Status: 500 (if not caught)
Example Request
cURL
JavaScript
Password Security
Passwords are hashed using bcrypt with 10 salt rounds before storage. The plain text password is never stored in the database.
- Original password:
empContrasenia - Hashed password:
empPassword(stored in database) - Algorithm: bcrypt
- Cost factor: 10 rounds
Database Schema
User data is stored in thecat_dgo_empleados table:
Validation Notes
Username uniqueness is case-sensitive based on database collation settings.