PasswordController ​
File: src/Http/Controllers/PasswordController.php
Namespace: Unusualify\Modularous\Http\Controllers
Extends: Controller
Traits: ManageUtilities, MakesResponses, ResetsPasswords
Middleware: modularous.guest
Handles two distinct password flows: the forgot-password reset flow (user already has an account) and the first-time password generation flow (new user completing registration).
Constructor ​
public function __construct()Applies the modularous.guest middleware to all actions — only unauthenticated users may access these routes.
Methods ​
showForm(Request $request, string $token): View ​
Displays the password entry form. The $token is validated against the password reset table before the form is shown. The form schema is loaded from getFormDraft('reset_password_form').
Used for both the forgot-password link (from email) and the welcome link (new user invitation).
savePassword(Request $request): JsonResponse|RedirectResponse ​
Validates the submitted password (with confirmation) and calls resetPassword().
On success:
- Marks the user's email as verified.
- Logs the user in via the modularous guard.
- Returns JSON for Inertia requests or redirects for traditional requests.
broker(): PasswordBroker ​
Returns the Laravel password broker configured for Modularous.
guard(): StatefulGuard ​
Returns the modularous authentication guard.
resetPassword($user, string $password): void ​
Sets the user's password, saves the model, and logs the user in.
Related ​
- Auth\ForgotPasswordController — sends the reset email
- Auth\ResetPasswordController — the standard Laravel reset flow