Skip to content

Commit c288463

Browse files
Disable OTP and auto-verify email due to Render SMTP blocking
1 parent 49e05ca commit c288463

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

auth/register_handler.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* Processes customer and tailor registrations
66
*/
77

8+
// Disable error display for clean JSON response
9+
ini_set('display_errors', 0);
10+
error_reporting(0);
11+
812
// Start session
913
session_start();
1014

@@ -95,13 +99,23 @@
9599
$address = isset($_POST['address']) ? trim($_POST['address']) : '';
96100

97101
// 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)");
99104
$stmt->bind_param("sssss", $name, $email, $phone, $password_hash, $address);
100105

101106
if ($stmt->execute()) {
102107
$user_id = $conn->insert_id;
103108
$stmt->close();
104109

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
105119
// Send OTP for email verification
106120
try {
107121
$otpService = new EmailOTPService($conn);
@@ -135,6 +149,7 @@
135149
'requires_otp' => false
136150
]);
137151
}
152+
*/
138153
} else {
139154
$stmt->close();
140155
throw new Exception('Registration failed. Please try again.');
@@ -179,13 +194,23 @@
179194
}
180195

181196
// 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)");
183199
$stmt->bind_param("sssssssssi", $name, $name, $email, $phone, $password_hash, $shop_address, $area, $speciality, $services, $experience);
184200

185201
if ($stmt->execute()) {
186202
$user_id = $conn->insert_id;
187203
$stmt->close();
188204

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
189214
// Send OTP for email verification
190215
try {
191216
$otpService = new EmailOTPService($conn);
@@ -217,6 +242,7 @@
217242
'requires_otp' => false
218243
]);
219244
}
245+
*/
220246
} else {
221247
$stmt->close();
222248
throw new Exception('Registration failed. Please try again.');

0 commit comments

Comments
 (0)