Home Forums WoodMart support forum Disable username login and force email login

Disable username login and force email login

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #576338

    luka.soldo007
    Participant

    Is there anyway to disable username login and only allow login with entering email?
    because of security..i have forum and username-as are visible and hacker can easier hack account or guess password by using their username

    is there way to allow login only by entering email + password (disable login by username)

    i know this is not change-able via theme because its woocommerce login but if you knonw way how to do it or at least any help in which way i should look to do it..i would appreciaite it very much

    i treid googling but i found nothing…neither one plugin does it

    #576339

    luka.soldo007
    Participant

    and how to add GDPR privacy policy checkbox when user comment on Woodmart Blog
    for following GDPR before posting there should be checkbox that is required to mark

    #576648

    Hung Pham
    Keymaster

    Hi luka.soldo007,

    Thanks for reaching to us.

    First of all, I’m really sorry have taken long time to reply you due to the weekend.

    1. Registration and Login are default WooCommerce functionalities and WoodMart does not control it. For specialized assistance and potential solutions, I kindly suggest that you reach out directly to the WooCommerce plugin’s support team https://wordpress.org/support/plugin/woocommerce/, who are better equipped to provide you with the guidance you requires.

    2. Unfortunately, there is no such an option right now. You need to find a third party plugin to achieve more functionality that best suits you.

    Regards,

    #583839

    luka.soldo007
    Participant

    1. i figure out how to set checkbox GDPR checkbox..
    2. i also resolve how to force email login, here is snipped code so you can help others when they ask
    there is also ability to allow certain user to continue login with username if you add their username on list

    // Function to authenticate using email only with exceptions
    function custom_email_login_authenticate($user, $username, $password) {
        // Check if the username is in the exception list
        $allowed_usernames = array(
            'testuser',        // Add usernames you want to allow to log in using username
            'specialuser',  // Add more usernames as needed
        );
    
        if (in_array($username, $allowed_usernames)) {
            return wp_authenticate_username_password(null, $username, $password); // Allow login with username
        }
    
        // If the username is not in the exception list, enforce email login
        if (!is_email($username)) {
            return new WP_Error('invalid_email', __('Please login using email not username'));
        }
    
        // Get user by email
        $user = get_user_by('email', $username);
    
        if ($user) {
            $username = $user->user_login;
        }
    
        // Continue with the standard authentication process
        return wp_authenticate_username_password(null, $username, $password);
    }
    add_filter('authenticate', 'custom_email_login_authenticate', 20, 3);

    Please check my other Topic i have issue with theme that i can’t resolve, thanks <3

    #583874

    Hung Pham
    Keymaster

    Hi luka.soldo007,

    Thanks for reaching to us.

    Glad to hear your issue has been resolved and thanks for sharing solutions. Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

    #583930

    luka.soldo007
    Participant

    Thank you very much..you can close this thread

    please check this one
    https://xtemos.com/forums/topic/woodmart-big-issue-cant-post-reviews-commennts/#post-583929

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Disable username login and force email login’ is closed to new replies.