LLMS_Controller_Account::validate_password_reset( array $posted_data )
Validates the password reset form.
Parameters Parameters
- $posted_data
-
(array) (Required) User submitted data.
Return Return
(WP_Error|true)
Source Source
File: includes/forms/controllers/class.llms.controller.account.php
protected function validate_password_reset( $posted_data ) { $err = new WP_Error(); $fields = LLMS_Person_Handler::get_password_reset_fields(); // Validate required fields. foreach ( $fields as &$field ) { $obj = new LLMS_Form_Field( $field ); $field = $obj->get_settings(); // Field is required, submittable, and wasn't posted. if ( ! empty( $field['required'] ) && ! empty( $field['name'] ) && empty( $posted_data[ $field['name'] ] ) ) { // Translators: %s = field label or id. $msg = sprintf( __( '%s is a required field.', 'lifterlms' ), isset( $field['label'] ) ? $field['label'] : $field['name'] ); $err->add( 'llms-password-reset-missing-field', $msg ); } } if ( count( $err->errors ) ) { return $err; } // If we have a password and password confirm and they don't match. if ( isset( $posted_data['password'] ) && isset( $posted_data['password_confirm'] ) && $posted_data['password'] !== $posted_data['password_confirm'] ) { $msg = __( 'The submitted passwords do must match.', 'lifterlms' ); $err->add( 'llms-passwords-must-match', $msg ); return $err; } return true; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |