Reply To: Passwort forgotten form?

Home Forums Quform WordPress Passwort forgotten form? Reply To: Passwort forgotten form?

#32702
MGmeiner
Participant

I tried this so far but get a ajax error back


// Check PW field if they match
add_filter('quform_element_valid_6_3', function ($valid, $value, Quform_Element_Password $element) {
    if ($value != $element->getForm()->getValue('quform_6_4')) {
        $element->addError('Die Passwörter stimmen nicht überein');
        $valid = false;
    }
    return $valid;
}, 10, 3);

// Password reset form - Check if token ist oky and reset password
add_action('quform_post_validate_6', function (array $result, Quform_Form $form) {
	if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
        $rp_key = $_REQUEST['key'];
        $rp_login = $_REQUEST['login'];
 
        $user = check_password_reset_key( $rp_key, $rp_login );
		  		
		$user_new_password = $form->getValue('quform_6_3');
		
		// Parameter checks OK, reset password
		if ( $user) {
			reset_password( $user, $user_new_password );
			wp_redirect( home_url( 'passwort-geaendert' ) );
		}
 
        exit;
    }
    return $result;
}, 10, 2);
  • This reply was modified 7 months, 2 weeks ago by MGmeiner.
  • This reply was modified 7 months, 2 weeks ago by MGmeiner.
Attachments:
You must be logged in to view attached files.
Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy