feat: change user controller for iran access

This commit is contained in:
2026-04-19 12:22:24 +00:00
parent bc86c41578
commit ae6b32a0b2
+16 -16
View File
@@ -231,21 +231,21 @@ public function register(Request $request)
$code = rand(1000, 9999); $code = rand(1000, 9999);
$token = Str::random(64); $token = Str::random(64);
// ✅ Check if email can receive a message before creating the user // ✅ Check if email can receive a message before creating the user
if (isset($data['email'])) { // if (isset($data['email'])) {
$code = rand(1000, 9999); // $code = rand(1000, 9999);
try { // try {
if ($method === 'code') { // if ($method === 'code') {
\Mail::to($data['email'])->send(new \App\Mail\VerifyEmailCodeMail($code)); // \Mail::to($data['email'])->send(new \App\Mail\VerifyEmailCodeMail($code));
} else { // } else {
$verificationUrl = url("api/auth/verify-email-link/{$token}?package={$packageNameValue}"); // $verificationUrl = url("api/auth/verify-email-link/{$token}?package={$packageNameValue}");
\Mail::to($data['email'])->send(new \App\Mail\VerifyEmailLinkMail($verificationUrl)); // \Mail::to($data['email'])->send(new \App\Mail\VerifyEmailLinkMail($verificationUrl));
} // }
} catch (\Exception $e) { // } catch (\Exception $e) {
return response()->json([ // return response()->json([
'error' => $e->getMessage(), // 'error' => $e->getMessage(),
'message' => 'لطفا آدرس ایمیل خود را بررسی کنید و مجدد تلاش کنید' // 'message' => 'لطفا آدرس ایمیل خود را بررسی کنید و مجدد تلاش کنید'
], 400); // ], 400);
} // }
// try { // try {
// // Try sending email // // Try sending email
// \Mail::to($data['email'])->send(new \App\Mail\VerifyEmailCodeMail($code)); // \Mail::to($data['email'])->send(new \App\Mail\VerifyEmailCodeMail($code));
@@ -257,7 +257,7 @@ public function register(Request $request)
// ], 400); // ], 400);
// } // }
} // }
// Hash password // Hash password
$data['password'] = isset($data['password']) $data['password'] = isset($data['password'])