Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Use wp_login_url instead of hardcoding login path #3090

Merged
merged 3 commits into from Sep 1, 2020

Conversation

senadir
Copy link
Member

@senadir senadir commented Aug 31, 2020

We had wp-login.php hardcoded in our code, this prevented some security plugins from changing its value, plugins like https://wordpress.org/plugins/change-wp-admin-login/ for example, in this pr we use wp_login_url which has a login_url filter.

Fixes #3037

How to test the changes in this Pull Request:

  1. In an incognito window and add some products and then go to Checkout.
  2. See the login URL, it should take you to wp-login.php?redirect_to=[CURRENT_URL]
  3. Enable checkout for users only from WooCommerce -> Settings -> Accounts -> uncheck Allow customers to place orders without an account.
  4. Visit Checkout again, the link should do the same.
  5. Install and activate https://wordpress.org/plugins/change-wp-admin-login/.
  6. Visit Settings -> Permalinks and change the login URL to something else.
  7. Do 1,2,3 and 4 again, confirm that your value is respected.

@senadir senadir added the type: bug The issue/PR concerns a confirmed bug. label Aug 31, 2020
@senadir senadir added this to the 3.4.0 milestone Aug 31, 2020
@senadir senadir requested a review from a team as a code owner August 31, 2020 18:14
@senadir senadir self-assigned this Aug 31, 2020
@senadir senadir requested review from Aljullu and removed request for a team August 31, 2020 18:14
@github-actions
Copy link
Contributor

Size Change: +718 B (0%)

Total Size: 1.11 MB

Filename Size Change
build/active-filters-frontend.js 8.78 kB +24 B (0%)
build/active-filters.js 8.85 kB +21 B (0%)
build/all-products-frontend.js 31.2 kB +26 B (0%)
build/all-products.js 35.7 kB +27 B (0%)
build/all-reviews.js 9.79 kB +25 B (0%)
build/atomic-block-components/image-frontend.js 1.71 kB +1 B
build/atomic-block-components/title.js 1.05 kB -1 B
build/attribute-filter-frontend.js 18.1 kB +29 B (0%)
build/attribute-filter.js 12.4 kB +22 B (0%)
build/cart-frontend.js 69 kB +28 B (0%)
build/cart.js 37.4 kB +28 B (0%)
build/checkout-frontend.js 84.2 kB +23 B (0%)
build/checkout.js 40.8 kB +20 B (0%)
build/featured-category.js 7.72 kB +23 B (0%)
build/featured-product.js 9.97 kB +23 B (0%)
build/handpicked-products.js 7.37 kB +25 B (0%)
build/price-filter-frontend.js 14.4 kB +25 B (0%)
build/price-filter.js 10.3 kB +24 B (0%)
build/product-best-sellers.js 7.44 kB +23 B (0%)
build/product-category.js 8.38 kB +24 B (0%)
build/product-new.js 7.6 kB +25 B (0%)
build/product-on-sale.js 7.99 kB +25 B (0%)
build/product-search.js 3.56 kB +25 B (0%)
build/product-tag.js 6.52 kB +26 B (0%)
build/product-top-rated.js 7.57 kB +24 B (0%)
build/products-by-attribute.js 8.31 kB +27 B (0%)
build/reviews-by-category.js 11.8 kB +25 B (0%)
build/reviews-by-product.js 13.4 kB +23 B (0%)
build/reviews-frontend.js 9.37 kB +23 B (0%)
build/single-product-frontend.js 34 kB +29 B (0%)
build/single-product.js 10.1 kB +26 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/atomic-block-components/add-to-cart-frontend.js 8.89 kB 0 B
build/atomic-block-components/add-to-cart.js 7.46 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/button.js 3.16 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js 335 B 0 B
build/atomic-block-components/button-frontend.js 2.02 kB 0 B
build/atomic-block-components/button.js 835 B 0 B
build/atomic-block-components/category-list-frontend.js 469 B 0 B
build/atomic-block-components/category-list.js 475 B 0 B
build/atomic-block-components/image.js 1.15 kB 0 B
build/atomic-block-components/price-frontend.js 2.1 kB 0 B
build/atomic-block-components/price.js 2.13 kB 0 B
build/atomic-block-components/rating-frontend.js 524 B 0 B
build/atomic-block-components/rating.js 527 B 0 B
build/atomic-block-components/sale-badge-frontend.js 863 B 0 B
build/atomic-block-components/sale-badge.js 864 B 0 B
build/atomic-block-components/sku-frontend.js 389 B 0 B
build/atomic-block-components/sku.js 394 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 568 B 0 B
build/atomic-block-components/stock-indicator.js 571 B 0 B
build/atomic-block-components/summary-frontend.js 918 B 0 B
build/atomic-block-components/summary.js 925 B 0 B
build/atomic-block-components/tag-list-frontend.js 466 B 0 B
build/atomic-block-components/tag-list.js 472 B 0 B
build/atomic-block-components/title-frontend.js 1.22 kB 0 B
build/blocks.js 3.54 kB 0 B
build/editor-rtl.css 13.9 kB 0 B
build/editor.css 13.9 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/style-rtl.css 18 kB 0 B
build/style.css 18 kB 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors.js 416 kB 0 B
build/vendors~atomic-block-components/price-frontend.js 5.65 kB 0 B
build/wc-blocks-data.js 7.09 kB 0 B
build/wc-blocks-middleware.js 931 B 0 B
build/wc-blocks-registry.js 2.28 kB 0 B
build/wc-payment-method-bacs.js 790 B 0 B
build/wc-payment-method-cheque.js 787 B 0 B
build/wc-payment-method-cod.js 875 B 0 B
build/wc-payment-method-paypal.js 831 B 0 B
build/wc-payment-method-stripe.js 11.9 kB 0 B
build/wc-settings.js 2.33 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.66 kB 0 B

compressed-size-action

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm. 👌

@senadir senadir merged commit 22d3d15 into main Sep 1, 2020
@senadir senadir deleted the fix/remove-hardcoded-login-url branch September 1, 2020 09:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give developers access to change the login link when user is not logged in directly into the checkout block
3 participants