submit_update_password()
public function submit_update_password(): void
Description
Handles the password update form submission. Validates that the password meets minimum requirements (8+ characters, matches confirmation), then updates the password in the database.
On success, redirects to the record's show page with a flash message. On validation failure, redisplays the password update form with errors.
Parameters
This method accepts no parameters (expects $_POST['password'], $_POST['confirm_password'], and URL segment 3 for the record ID).
Return Value
| Type | Description |
|---|---|
| void | Redirects after processing. |
Example Usage
PHP
// Form that submits to this method
<form method="post"
action="<?= BASE_URL ?>trongate_administrators/submit_update_password/<?= $update_id ?>">
<input type="password" name="password" placeholder="New password">
<input type="password" name="confirm_password" placeholder="Confirm password">
<button type="submit" name="submit" value="Update Password">Update Password</button>
</form>
// Typical flow:
// 1. User fills form and submits
// 2. Validates: required|min_length[8] + matches[password]
// 3. On success: updates DB and redirects to show page
// 4. On failure: redisplays form with error messages