Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Login (no widget) Does not work with WooCommerce My Account Login #45

Closed
cancan101 opened this issue Apr 9, 2015 · 4 comments
Closed

Comments

@cancan101
Copy link

I selected "Auto Login (no widget)" but the "My Account" page on WooCommerce shows:
image
and I am unable to use an email/password here that works with the select Auth0 connection.

related: https://ask.auth0.com/t/auth0-plugin-for-wp-not-fully-replacing-normal-login/794

@cancan101
Copy link
Author

It looks like WooCommerce has it's own login form that is not using the Auth0 backend. From woocommerce/templates/myaccount/form-login.php:

        <form method="post" class="login">

            <?php do_action( 'woocommerce_login_form_start' ); ?>

            <p class="form-row form-row-wide">
                <label for="username"><?php _e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label>
                <input type="text" class="input-text" name="username" id="username" value="<?php if ( ! empty( $_POST['username'] ) ) echo esc_attr( $_POST['username'] ); ?>" />
            </p>
            <p class="form-row form-row-wide">
                <label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
                <input class="input-text" type="password" name="password" id="password" />
            </p>

            <?php do_action( 'woocommerce_login_form' ); ?>

            <p class="form-row">
                <?php wp_nonce_field( 'woocommerce-login' ); ?>
                <input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woocommerce' ); ?>" />
                <label for="rememberme" class="inline">
                    <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e( 'Remember me', 'woocommerce' ); ?>
                </label>
            </p>
            <p class="lost_password">
                <a href="<?php echo esc_url( wc_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'woocommerce' ); ?></a>
            </p>

            <?php do_action( 'woocommerce_login_form_end' ); ?>

        </form>

@cancan101
Copy link
Author

I believe you need to hook for this event: wp_signon:

                        $creds['user_password'] = $_POST['password'];
                        $creds['remember']      = isset( $_POST['rememberme'] );
                        $secure_cookie          = is_ssl() ? true : false;
                        $user                   = wp_signon( apply_filters( 'woocommerce_login_credentials', $creds ), $secure_cookie );

                        if ( is_wp_error( $user ) ) {
                                throw new Exception( $user->get_error_message() );
                        } else {

@cancan101
Copy link
Author

@glena
Copy link
Contributor

glena commented May 15, 2015

Hey @cancan101

I have been working on WooCommerce support.
If you want, you can check the code on https://github.com/auth0/wp-auth0/tree/dev to see if it works for your environment as you expect and if it covers your needs.

Thanks

@glena glena closed this as completed May 19, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants