Add change password UI and AJAX handler#1853
Conversation
Introduce a new Change Password account section and full AJAX flow. Changes include:
- Register a new account section key ('change-password') in wpuf_get_account_sections().
- Add a change-password dashboard template (templates/dashboard/change-password.php) with password strength meter, eye toggle, nonce, and AJAX submission UI. Enqueues zxcvbn/password-strength-meter and uses an eye icon asset when available.
- Add Frontend_Account::change_password_section() to load the template and Frontend_Account::change_password() to handle the AJAX request: nonce and auth checks, input validation, current password verification, wp_update_user call, and JSON success/error responses.
- Update includes/Ajax.php to instantiate Frontend_Account once and register the new wpuf_account_change_password AJAX action (logged-in only).
- Add a menu icon for the change-password section in templates/account.php.
This implements a complete frontend flow for users to change their password securely.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 39 minutes and 14 seconds.Comment |
WPUF Account Page — Change Password Tab
Overview
Add a dedicated Change Password tab to the WPUF account page sidebar, positioned immediately after "Edit Profile". The tab is separate from Edit Profile so users have a single-purpose, focused flow for updating credentials.
Design Goals
wp_unslash, nonces,snake_case)Tab Position
Insertion is done inside
wpuf_get_account_sections()viaarray_mergeso the keychange-passwordlands afteredit-profile.Icon
Shield-check SVG from
/WPUF icons-outline 3/Vector.svg:Template:
templates/dashboard/change-password.phpFields
current_passwordpass1pass2Infotip Implementation
Pure HTML/CSS tooltip using a
?icon button withtitleattribute and a sibling<span class="wpuf-field-hint">element. No extra JS library needed — uses the samewpuf-field-hintclass pattern already present in WPUF forms.Password Strength
Show
#pass-strength-resultbar beneath the "New Password" field — same JSwp.passwordStrength.meter()call as inedit-profile.php.NONCE & AJAX
wpuf-account-change-passwordwpuf_account_change_password.wpuf-successmessage, clear all three fields.wpuf-errorwith the returned messageButton
Backend Changes
1.
wpuf-functions.php—wpuf_get_account_sections()Insert
change-passwordkey immediately afteredit-profilein the base$sectionsarray:2.
includes/Frontend/Frontend_Account.phpConstructor — register action hook:
New method
change_password_section():New method
change_password()(AJAX handler):3.
includes/Ajax.phpRegister the new AJAX action (logged-in only):
4.
templates/account.php— nav icon switch-caseAdd
change-passwordcase before thedefault:File Checklist
wpuf-functions.phpchange-passwordto$sectionsarray inwpuf_get_account_sections()includes/Frontend/Frontend_Account.phpchange_password_section()+ addchange_password()AJAX methodincludes/Ajax.phpwpuf_account_change_passwordAJAX actiontemplates/account.phpchange-passwordicon case in nav switchtemplates/dashboard/change-password.phpNo Breaking Changes
wpuf_account_sectionsfilter still fires — Pro / modules can remove this tabupdate_profile()is untouched — Edit Profile still works as beforewpuf-form-group,wpuf-form-label,wpuf-form-input,wpuf-password-field,wpuf-btn-*classesClose 1313