|
5 | 5 | * Processes customer and tailor registrations |
6 | 6 | */ |
7 | 7 |
|
| 8 | +// Disable error display for clean JSON response |
| 9 | +ini_set('display_errors', 0); |
| 10 | +error_reporting(0); |
| 11 | + |
8 | 12 | // Start session |
9 | 13 | session_start(); |
10 | 14 |
|
|
95 | 99 | $address = isset($_POST['address']) ? trim($_POST['address']) : ''; |
96 | 100 |
|
97 | 101 | // Insert customer using prepared statement |
98 | | - $stmt = $conn->prepare("INSERT INTO customers (full_name, email, phone, password, address, email_verified) VALUES (?, ?, ?, ?, ?, 0)"); |
| 102 | + // Auto-verify email since SMTP is blocked on Render free tier |
| 103 | + $stmt = $conn->prepare("INSERT INTO customers (full_name, email, phone, password, address, email_verified) VALUES (?, ?, ?, ?, ?, 1)"); |
99 | 104 | $stmt->bind_param("sssss", $name, $email, $phone, $password_hash, $address); |
100 | 105 |
|
101 | 106 | if ($stmt->execute()) { |
102 | 107 | $user_id = $conn->insert_id; |
103 | 108 | $stmt->close(); |
104 | 109 |
|
| 110 | + // Skip OTP sending to prevent timeouts |
| 111 | + echo json_encode([ |
| 112 | + 'success' => true, |
| 113 | + 'message' => 'Registration successful! You can login now.', |
| 114 | + 'user_type' => 'customer', |
| 115 | + 'requires_otp' => false |
| 116 | + ]); |
| 117 | + |
| 118 | + /* OTP Disabled for Render Deployment |
105 | 119 | // Send OTP for email verification |
106 | 120 | try { |
107 | 121 | $otpService = new EmailOTPService($conn); |
|
135 | 149 | 'requires_otp' => false |
136 | 150 | ]); |
137 | 151 | } |
| 152 | + */ |
138 | 153 | } else { |
139 | 154 | $stmt->close(); |
140 | 155 | throw new Exception('Registration failed. Please try again.'); |
|
179 | 194 | } |
180 | 195 |
|
181 | 196 | // Insert tailor using prepared statement |
182 | | - $stmt = $conn->prepare("INSERT INTO tailors (shop_name, owner_name, email, phone, password, shop_address, area, speciality, services_offered, experience_years, price_range, email_verified) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'medium', 0)"); |
| 197 | + // Auto-verify email since SMTP is blocked on Render free tier |
| 198 | + $stmt = $conn->prepare("INSERT INTO tailors (shop_name, owner_name, email, phone, password, shop_address, area, speciality, services_offered, experience_years, price_range, email_verified) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'medium', 1)"); |
183 | 199 | $stmt->bind_param("sssssssssi", $name, $name, $email, $phone, $password_hash, $shop_address, $area, $speciality, $services, $experience); |
184 | 200 |
|
185 | 201 | if ($stmt->execute()) { |
186 | 202 | $user_id = $conn->insert_id; |
187 | 203 | $stmt->close(); |
188 | 204 |
|
| 205 | + // Skip OTP sending to prevent timeouts |
| 206 | + echo json_encode([ |
| 207 | + 'success' => true, |
| 208 | + 'message' => 'Tailor registration successful! Your profile will be reviewed and activated soon.', |
| 209 | + 'user_type' => 'tailor', |
| 210 | + 'requires_otp' => false |
| 211 | + ]); |
| 212 | + |
| 213 | + /* OTP Disabled for Render Deployment |
189 | 214 | // Send OTP for email verification |
190 | 215 | try { |
191 | 216 | $otpService = new EmailOTPService($conn); |
|
217 | 242 | 'requires_otp' => false |
218 | 243 | ]); |
219 | 244 | } |
| 245 | + */ |
220 | 246 | } else { |
221 | 247 | $stmt->close(); |
222 | 248 | throw new Exception('Registration failed. Please try again.'); |
|
0 commit comments