403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/project-slim/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/project-slim//REGISTRATION_VALIDATION_TESTS.md
# Registration Validation Test

## Test the registration endpoint with missing fields to verify validation works correctly.

### Test Case 1: Missing All Fields
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{}'
```

**Expected Response:**
```json
{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "first_name": "First_name is required",
    "last_name": "Last_name is required",
    "email": "Email is required",
    "company_name": "Company_name is required",
    "company_domain": "Company_domain is required",
    "password": "Password is required",
    "confirm_password": "Confirm_password is required"
  }
}
```

### Test Case 2: Invalid Email Format
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "invalid-email",
    "company_name": "Test Company",
    "company_domain": "testcompany.com",
    "password": "password123",
    "confirm_password": "password123"
  }'
```

**Expected Response:**
```json
{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "email": "Invalid email"
  }
}
```

### Test Case 3: Password Mismatch
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@testcompany.com",
    "company_name": "Test Company",
    "company_domain": "testcompany.com",
    "password": "password123",
    "confirm_password": "differentpassword"
  }'
```

**Expected Response:**
```json
{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "confirm_password": "Passwords do not match"
  }
}
```

### Test Case 4: Password Too Short
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@testcompany.com",
    "company_name": "Test Company",
    "company_domain": "testcompany.com",
    "password": "123",
    "confirm_password": "123"
  }'
```

**Expected Response:**
```json
{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "password": "Password must be at least 8 characters long"
  }
}
```

### Test Case 5: Invalid Company Domain
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@testcompany.com",
    "company_name": "Test Company",
    "company_domain": "invalid..domain",
    "password": "password123",
    "confirm_password": "password123"
  }'
```

**Expected Response:**
```json
{
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "company_domain": "Invalid company_domain"
  }
}
```

### Test Case 6: Valid Registration
```bash
curl -X POST http://localhost/project-slim/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@testcompany.com",
    "company_name": "Test Company",
    "company_domain": "testcompany.com",
    "password": "password123",
    "confirm_password": "password123"
  }'
```

**Expected Response:**
```json
{
  "status": "success",
  "message": "Registration successful",
  "data": {
    "user": {
      "public_id": "usr_...",
      "first_name": "John",
      "last_name": "Doe",
      "email": "john@testcompany.com",
      "company_name": "Test Company",
      "company_domain": "testcompany.com",
      "is_active": true,
      "email_verified": false
    },
    "message": "User registered successfully. Please verify your email.",
    "verification_token": "..."
  }
}
```

## Validation Rules Implemented

1. **Required Fields Validation**: All 7 fields are mandatory
   - First Name
   - Last Name
   - Business Email
   - Company Name
   - Company Domain
   - Password
   - Confirm Password

2. **Email Format Validation**: Uses PHP's FILTER_VALIDATE_EMAIL

3. **Password Confirmation**: Ensures password and confirm_password match

4. **Password Strength**: Minimum 8 characters (can be enhanced)

5. **Domain Format Validation**: Basic regex for valid domain format

6. **Security Features**:
   - No internal ID exposure
   - Password is hashed before storage
   - Email verification token generated
   - All model fields properly hidden

Youez - 2016 - github.com/yon3zu
LinuXploit