diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml index 2000cbbd..344adf6a 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml @@ -53,7 +53,11 @@

$@Model.TotalPrice.ToString("0.00")

- +
+ @Html.AntiForgeryToken() + + +
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml index 4545fae1..4f9727d3 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml @@ -2,7 +2,7 @@ @using EShopOnAbp.Localization @using EShopOnAbp.PublicWeb.Components.Basket @using Microsoft.Extensions.Localization -@model EShopOnAbp.PublicWeb.Pages.Basket +@model EShopOnAbp.PublicWeb.Pages.BasketModel @section scripts { diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs index 8de8b3c4..da1cbc36 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs @@ -1,11 +1,30 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace EShopOnAbp.PublicWeb.Pages; -public class Basket : PageModel +public class BasketModel : AbpPageModel { + private readonly ILogger _logger; + + public BasketModel(ILogger logger) + { + _logger = logger; + } + public void OnGet() { - + } + + public IActionResult OnPostAsync() + { + if (!CurrentUser.IsAuthenticated) + { + _logger.LogInformation("Redirecting to Login"); + return Challenge(); + } + + return RedirectToPage("Payment"); } } \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js index 40abc2e9..5cd37a90 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js @@ -27,15 +27,15 @@ }); }); - $wrapper - .find('.basket-purchase-button') - .click(function () { - eShopOnAbp.basketService.basket.purchase().then(function () { - widgetManager.refresh(); - - abp.notify.info("Thank you for the payment!", "Purchase completed!"); - }); - }); + // $wrapper + // .find('.basket-purchase-button') + // .click(function () { + // eShopOnAbp.basketService.basket.purchase().then(function () { + // widgetManager.refresh(); + // + // abp.notify.info("Thank you for the payment!", "Purchase completed!"); + // }); + // }); }; return {