AccountClaimMiddleware.php
3 years ago
ArchiveModelMiddleware.php
3 years ago
BrandColorMiddleware.php
3 years ago
CheckoutRedirectMiddleware.php
3 years ago
ComponentAssetsMiddleware.php
3 years ago
CustomerDashboardRedirectMiddleware.php
3 years ago
EditModelMiddleware.php
3 years ago
LoginLinkMiddleware.php
3 years ago
LoginMiddleware.php
3 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
WebhooksMiddleware.php
2 years ago
LoginMiddleware.php
21 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Middleware; |
| 4 | |
| 5 | use Closure; |
| 6 | use SureCartCore\Requests\RequestInterface; |
| 7 | use SureCartCore\Responses\RedirectResponse; |
| 8 | |
| 9 | class LoginMiddleware { |
| 10 | // Note the new $capability parameter: |
| 11 | public function handle( RequestInterface $request, Closure $next, $model_name ) { |
| 12 | // check nonce. |
| 13 | if ( ! $request->query( 'nonce' ) || ! wp_verify_nonce( $request->query( 'nonce' ), 'ce_login' ) ) { |
| 14 | \SureCart::flash()->add( 'errors', __( 'Your session expired - please try again.', 'surecart' ) ); |
| 15 | return ( new RedirectResponse( $request ) )->back(); |
| 16 | } |
| 17 | |
| 18 | return $next( $request ); |
| 19 | } |
| 20 | } |
| 21 |