Viewing 12 replies - 1 through 12 (of 12 total)
  • I would first try going to your phpMyAdmin to look for the UM database, then the WP user table and check to see what it says for that user email. Make the correction if necessary but foreign characters could be a problem on DBs.

    @adonnan

    I tried this on my UM test site with UM Registration and UM Login
    with this email: miss`veronica@…. without any problems.

    • This reply was modified 2 years, 4 months ago by missveronica.
    Thread Starter adonnan

    (@adonnan)

    Interesting @missveronicatv – maybe it’s a cache configuration I’ve missed with cloudways. @borisv ill check but may push back for this particular login and make it without the apostrophe.

    • This reply was modified 2 years, 4 months ago by adonnan.
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @adonnan

    Thanks for contacting our support.

    Try deactivating other plugins and leaving UM active. Let’s see if this is a plugin conflict issue.

    Thread Starter adonnan

    (@adonnan)

    @ultimatemembersupport I believe that I have completed all the steps to limit cache for the hosting environment and I also tried disabling all plugins on the site. Here’s an updated video. Still unresolved. https://www.loom.com/share/c284802651b7467bbe2ff06e118ebef3

    Thank you for the support. This is a super odd issue.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @adonnan

    Could you please check the meta key of the Password field that you added to your custom Login form?

    Thread Starter adonnan

    (@adonnan)

    @ultimatemembersupport user_password is the Meta Key for the password field. This login has worked for 900 other users.

    @adonnan

    There are three different characters that represent an apostrophe.
    Read the Unicode section here:

    https://en.wikipedia.org/wiki/Apostrophe

    Can you try to copy the email address from WP Users and use for the login test.

    Try also to reset the password and use the email address copy from WP Users.

    Thread Starter adonnan

    (@adonnan)

    @missveronicatv I reset the password via admin after copying the email address from WP users but still the same issue.

    @adonnan

    I suspect that you have a backslash infront of the apostrophe added by the browser.
    This backslash must be removed when searching for the user email.

    You can try this code snippet, install into your child-theme’s functions.php file or use the “Code Snippets” plugin.

    The code snippet will replace current UM login authentication code with new code removing any backslashes in username or email fields before WP is searching in the database for the email.

    remove_action( 'um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10 );
    add_action( 'um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login_custom', 10, 1 );
    
    function um_submit_form_errors_hook_login_custom( $args ) {
    	$is_email = false;
    
    	$form_id = $args['form_id'];
    	$mode = $args['mode'];
    	$user_password = $args['user_password'];
    
    	if ( isset( $args['username'] ) && $args['username'] == '' ) {
    		UM()->form()->add_error( 'username', __( 'Please enter your username or email', 'ultimate-member' ) );
    	}
    
    	if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
    		UM()->form()->add_error( 'user_login', __( 'Please enter your username', 'ultimate-member' ) );
    	}
    
    	if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
    		UM()->form()->add_error( 'user_email', __( 'Please enter your email', 'ultimate-member' ) );
    	}
    
    	if ( isset( $args['username'] ) ) {
    		$args['username'] = stripslashes( $args['username'] );
            $authenticate = $args['username'];
    		$field = 'username';
    		if ( is_email( $args['username'] ) ) {
    			$is_email = true;
    			$data = get_user_by('email', $args['username'] );
    			$user_name = isset( $data->user_login ) ? $data->user_login : null;
    		} else {
    			$user_name  = $args['username'];
    		}
    	} elseif ( isset( $args['user_email'] ) ) {
    		$args['user_email'] = stripslashes( $args['user_email'] );
            $authenticate = $args['user_email'];
    		$field = 'user_email';
    		$is_email = true;
    		$data = get_user_by('email', $args['user_email'] );
    		$user_name = isset( $data->user_login ) ? $data->user_login : null;
    	} else {
    		$field = 'user_login';
    		$user_name = $args['user_login'];
    		$authenticate = $args['user_login'];
    	}
    
    	if ( $args['user_password'] == '' ) {
    		UM()->form()->add_error( 'user_password', __( 'Please enter your password', 'ultimate-member' ) );
    	}
    
    	$user = get_user_by( 'login', $user_name );
    	if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID ) ) {
    		UM()->login()->auth_id = username_exists( $user_name );
    	} else {
    		UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
    	}
    
    	// @since 4.18 replacement for 'wp_login_failed' action hook
    	// see WP function wp_authenticate()
    	$ignore_codes = array( 'empty_username', 'empty_password' );
    
    	$user = apply_filters( 'authenticate', null, $authenticate, $args['user_password'] );
    	if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
    		UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
    	}
    
    	$user = apply_filters( 'wp_authenticate_user', $user, $args['user_password'] );
    	if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
    		UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
    	}
    
    	// if there is an error notify wp
    	if ( UM()->form()->has_error( $field ) || UM()->form()->has_error( $user_password ) || UM()->form()->count_errors() > 0 ) {
    		do_action( 'wp_login_failed', $user_name, UM()->form()->get_wp_error() );
    	}
    }
    Thread Starter adonnan

    (@adonnan)

    @missveronicatv You’re my hero. Thank you that resolved the issue!

    @adonnan

    Thanks for your feedback.
    Your apostrophe issue is now reported as an UM bug:

    https://github.com/ultimatemember/ultimatemember/issues/1059

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘login with email address that contains an apostrophe’ is closed to new replies.