fix reset password
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Failing after 1m20s

This commit is contained in:
root
2026-08-26 20:45:23 -04:00
parent 9899af7b37
commit a354d78fa9
11 changed files with 88 additions and 25 deletions
+2 -3
View File
@@ -933,8 +933,8 @@ class ParentController extends BaseController
$errors[] = 'A valid 10-digit home/cell phone number is required.';
}
if ($street === '' || strlen($street) < 2 || strlen($street) > 50 || ! preg_match('/^[A-Za-z0-9.\s\-]+$/', $street)) {
$errors[] = 'Home street address must be 250 characters and may contain only letters, numbers, spaces, periods, and hyphens.';
if ($street === '' || strlen($street) < 3 || strlen($street) > 50 || ! preg_match('/^[A-Za-z0-9.\s\-]+$/', $street)) {
$errors[] = 'Home street address must be 350 characters and may contain only letters, numbers, spaces, periods, and hyphens.';
}
if ($apt !== '' && (strlen($apt) > 15 || ! preg_match('/^[A-Za-z0-9.\s\-]+$/', $apt))) {
@@ -2884,7 +2884,6 @@ class ParentController extends BaseController
'parent_id' => (int) $parentId,
'year_of_registration' => date('Y'),
'school_year' => $schoolYear,
'semester' => $semester,
];
if (!is_null($isNew)) {
+9 -1
View File
@@ -459,6 +459,8 @@ class UserController extends BaseController
// --- Handle unknown or unverified email ---
if (!$user || (int) $user['is_verified'] === 0) {
session()->setFlashdata('success', 'If this email is registered, you will receive a reset link.');
session()->setFlashdata('show_modal', true);
session()->setFlashdata('email', $email);
log_message('info', "Password reset requested for {$email} (user missing or unverified).");
return redirect()->back();
}
@@ -478,6 +480,8 @@ class UserController extends BaseController
$this->sendResetEmail($email, $token);
session()->setFlashdata('success', 'A password reset link has been sent to your email.');
session()->setFlashdata('show_modal', true);
session()->setFlashdata('email', $email);
log_message('info', "Password reset email sent to {$email}");
return redirect()->back();
@@ -633,14 +637,18 @@ class UserController extends BaseController
$ipAttemptModel->where('ip_address', $ipAddress)->delete();
}
$this->resetRequestModel->where('ip_address', $ipAddress)->delete();
// Redirect to a success page with a success message
return view('user/password_set_success');
return redirect()->to('/user/password_set_success');
}
public function passwordSetSuccess()
{
$this->resetRequestModel->where('ip_address', $this->request->getIPAddress())->delete();
return view('user/password_set_success');
}