AccountClaimMiddleware.php
3 years ago
AdminColorMiddleware.php
2 years ago
ArchiveModelMiddleware.php
3 years ago
BrandColorMiddleware.php
3 years ago
CheckoutFormModeMiddleware.php
2 years ago
CheckoutRedirectMiddleware.php
3 years ago
ComponentAssetsMiddleware.php
3 years ago
CustomerDashboardRedirectMiddleware.php
3 years ago
EditModelMiddleware.php
3 years ago
InvoiceRedirectMiddleware.php
1 year ago
LoginLinkMiddleware.php
1 year ago
LoginMiddleware.php
2 years ago
NonceMiddleware.php
3 years ago
OrderRedirectMiddleware.php
3 years ago
PathRedirectMiddleware.php
3 years ago
PaymentFailureRedirectMiddleware.php
3 years ago
PurchaseRedirectMiddleware.php
3 years ago
SubscriptionRedirectMiddleware.php
3 years ago
UpsellMiddleware.php
2 years ago
WebhooksMiddleware.php
2 years ago
LoginMiddleware.php
22 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Middleware; |
| 4 | |
| 5 | use Closure; |
| 6 | use SureCartCore\Requests\RequestInterface; |
| 7 | |
| 8 | class LoginMiddleware { |
| 9 | // Note the new $capability parameter: |
| 10 | public function handle( RequestInterface $request, Closure $next, $model_name ) { |
| 11 | // check nonce. |
| 12 | if ( ! $request->query( 'nonce' ) || ! wp_verify_nonce( $request->query( 'nonce' ), 'ce_login' ) ) { |
| 13 | \SureCart::flash()->add( 'errors', __( 'Your session expired - please try again.', 'surecart' ) ); |
| 14 | |
| 15 | // Redirect back to login page again. |
| 16 | return \SureCart::redirect()->to( esc_url_raw( \SureCart::pages()->url( 'dashboard' ) ) ); |
| 17 | } |
| 18 | |
| 19 | return $next( $request ); |
| 20 | } |
| 21 | } |
| 22 |