fix all issues

This commit is contained in:
root
2026-03-24 01:02:36 -04:00
parent 0f8a1fa0b1
commit 58445b2a48
19 changed files with 674 additions and 167 deletions
+5 -12
View File
@@ -173,16 +173,8 @@ class RegisterController extends Controller
$existingUser = $this->userModel->where('email', $post['email'])->first();
if ($existingUser) {
// Step 2: Check if the user has a token (i.e., not verified yet)
if (!empty($existingUser['token']) && $existingUser['is_verified'] == 0) {
// User exists and is unverified
return redirect()->back()->withInput()->with('error',
'This email address is already registered and is pending activation. Please check your email to activate your account.');
} else {
// User exists and is already active or has no token
return redirect()->back()->withInput()->with('error',
'The email address you entered is already in use. Please try a different one.');
}
return redirect()->back()->withInput()->with('error',
'This email address is already registered. Please check your email or log in.');
}
/* ───────────── 6. Determine role ───────────── */
@@ -194,6 +186,7 @@ class RegisterController extends Controller
/* ───────────── 7. Build & insert user ───────────── */
$token = bin2hex(random_bytes(48));
$tokenHash = hash('sha256', $token);
$userData = [
'firstname' => $post['firstname'],
'lastname' => $post['lastname'],
@@ -205,7 +198,7 @@ class RegisterController extends Controller
'city' => $post['city'],
'state' => $post['state'],
'zip' => $post['zip'],
'token' => $token,
'token' => $tokenHash,
'is_verified'=> 0,
'accept_school_policy' => (int) $post['accept_school_policy'],
'status' => 'Inactive',
@@ -357,4 +350,4 @@ class RegisterController extends Controller
}
}