PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.19
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.19
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
← All changes | includes/Templates/Auth.php +12 -3 1.10.21.10.19 View file →
@@ -18,8 +18,9 @@
18 18 namespace WCPOS\WooCommercePOS\Templates;
19 19
20 20 use WCPOS\WooCommercePOS\Logger;
21 21 use WCPOS\WooCommercePOS\Services\Auth as AuthService;
22 +use WCPOS\WooCommercePOS\Services\Cashier;
22 23 use WP_Error;
23 24 use WP_User;
24 25
25 26 /**
@@ -53,11 +54,19 @@
53 54
54 55 /**
55 56 * Allowed redirect URI schemes.
56 57 *
58 + * The native app registers one URL scheme per build profile so that a
59 + * device with two variants installed (e.g. the store build and the dev
60 + * client) returns the login to the app that started it: `wcpos` for the
61 + * store build, `wcpos-dev` for the development client, `wcpos-adhoc` for
62 + * ad-hoc test builds (monorepo `apps/main/app.config.ts`). `exp` is the
63 + * Expo Go client. Matching is an exact `<scheme>://` prefix, so listing
64 + * `wcpos-dev` does not admit `wcpos-devious`.
65 + *
57 66 * @var array
58 67 */
59 - private const ALLOWED_SCHEMES = array( 'wcpos', 'exp', 'https', 'http' );
68 + private const ALLOWED_SCHEMES = array( 'wcpos', 'wcpos-dev', 'wcpos-adhoc', 'exp', 'https', 'http' );
60 69
61 70 /**
62 71 * The redirect URI.
63 72 *
@@ -308,11 +317,11 @@
308 317 return;
309 318 }
310 319
311 320 // Check if user has access to POS.
312 - if ( ! user_can( $user, 'access_woocommerce_pos' ) ) {
321 + if ( ! Cashier::instance()->can_open_pos( $user ) ) {
313 322 $this->log_auth_attempt( $username, 'no_permission' );
314 - $this->error = __( 'You do not have permission to access the POS.', 'woocommerce-pos' );
323 + $this->error = Cashier::instance()->missing_pos_capabilities_message( $user );
315 324
316 325 return;
317 326 }
318 327