Explorar o código

update website

vuDUng hai 1 semana
pai
achega
5124524fdb

+ 0 - 7
SicboSub/SicboSub.Api/appsettings.json

@@ -8,13 +8,6 @@
       "Http": {
         "Url": "http://127.0.0.1:9106"
       }
-      //"Https": {
-      //  "Url": "https://0.0.0.0:9107",
-      //  "Certificate": {
-      //    "Path": "/path/to/certificate.pfx",
-      //    "Password": "your-password"
-      //  }
-      //}
     }
   },
   "Logging": {

+ 16 - 1
SicboSub/SicboSub.Web/Controllers/HomeController.cs

@@ -194,7 +194,8 @@ namespace SicboSub.Web.Controllers
             if (!string.IsNullOrEmpty(token))
             {
                 log.Info($"Index: Token found in URL, attempting login...");
-
+                HttpContext.Session.GetComplexData<string?>("tokenRedirect");
+                HttpContext.Session.SetComplexData("tokenRedirect", token);
                 try
                 {
                     // Tạo request
@@ -253,6 +254,20 @@ namespace SicboSub.Web.Controllers
             return RedirectToLogin(_configuration);
         }
 
+        public async Task<IActionResult> Play()
+        {
+            var token = "";
+            // 1. Kiểm tra nếu đã đăng nhập từ trước
+            if (IsAuthenticated())
+            {
+                token = HttpContext.Session.GetComplexData<string>("tokenRedirect");
+                log.Info($"Play: token = "+ token);
+            }
+            var url = GetParameter("RedirectUrl") + "/?token=" + token;
+            log.Info($"PlayUrl: url = " + url);
+            return Redirect(url);
+        }
+
         public IActionResult Privacy()
         {
             if (!IsAuthenticated()) return RedirectToLogin(_configuration);

+ 1 - 1
SicboSub/SicboSub.Web/Program.cs

@@ -15,7 +15,7 @@ builder.Services.AddControllersWithViews();
 builder.Services.AddDistributedMemoryCache();
 builder.Services.AddSession(options =>
 {
-    options.IdleTimeout = TimeSpan.FromMinutes(30); // Session timeout 30 phút
+    options.IdleTimeout = TimeSpan.FromMinutes(5); // Session timeout 30 phút
     options.Cookie.HttpOnly = true;
     options.Cookie.IsEssential = true;
     options.Cookie.Name = ".Sicbo.Session";

+ 3 - 3
SicboSub/SicboSub.Web/Views/Home/Index.cshtml

@@ -91,7 +91,7 @@
             <img class="vector-icon3" src="~/img/Frame 1244831300.svg" alt="">
             <img class="vector-icon4" src="~/img/Frame 1244831300.svg" alt="">
 
-            <div class="button-label3">Play</div>
+            <div class="button-label3">@Language.Play</div>
         </div>
     </div>
     <!-- <img class="home-barpro-icon" alt=""> -->
@@ -795,8 +795,8 @@
 
         function handlePlay() {
             // TODO: Implement play logic
-            Site.showSuccess('Starting game...'); // Use new popup example
-            // window.location.href = '/Home/Play';
+            // Site.showSuccess('Starting game...'); Use new popup example
+            window.location.href = '/Home/Play';
         }
     </script>
 }

+ 1 - 1
SicboSub/SicboSub.Web/appsettings.json

@@ -7,7 +7,7 @@
   },
   "AllowedHosts": "*",
   "Url": "http://127.0.0.1:9106",
-  "RedirectUrl": "http://localhost:5042?token=",
+  "RedirectUrl": "http://149.28.132.56:8110",
   "PackageCodeDaily": "SICBO_DAY",
   "Kestrel": {
     "EndPoints": {