OnPostLogoutAsync()
+ {
+ if (!ModelState.IsValid)
+ {
+ return BadRequest();
+ }
+
+ if (!string.IsNullOrEmpty(Request.Cookies["SessionId"]) && !string.IsNullOrEmpty(Request.Cookies["UserId"]))
+ {
+ using (HttpClient secureClient = new HttpClient())
+ {
+ if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ {
+ var logoutUrl = $"{APIRoot.Url}/api/users/delsession?userId={Request.Cookies["UserId"]}&sessionId={Request.Cookies["SessionId"]}";
+ await secureClient.DeleteAsync(logoutUrl);
+ }
+ }
+ }
+
+
+ var cookieOption = new CookieOptions()
+ {
+ Expires = DateTime.Now.AddDays(-1)
+ };
+ foreach (var cookieName in new string[] { "UserId", "SessionId", "Token", "Username", "Name", "NickName", "CanEdit" })
+ {
+ if (Request.Cookies[cookieName] != null)
+ {
+ Response.Cookies.Append(cookieName, "", cookieOption);
+ }
+ }
+
+
+ return Redirect(Request.Path);
+ }
}
}
diff --git a/GanjooRazor/Pages/_InlineLoginPartialForSearch.cshtml b/GanjooRazor/Pages/_InlineLoginPartialForSearch.cshtml
new file mode 100644
index 00000000..289f66e5
--- /dev/null
+++ b/GanjooRazor/Pages/_InlineLoginPartialForSearch.cshtml
@@ -0,0 +1,106 @@
+@model GanjooRazor.Pages.SearchModel
+@if (Model.LoggedIn)
+{
+
+}
+else
+{
+
+
+
+
+}
+
+
diff --git a/GanjooRazor/Pages/_VaznPage.cshtml.cs b/GanjooRazor/Pages/_VaznPage.cshtml.cs
index e5514b52..f77a0f59 100644
--- a/GanjooRazor/Pages/_VaznPage.cshtml.cs
+++ b/GanjooRazor/Pages/_VaznPage.cshtml.cs
@@ -29,7 +29,7 @@ namespace GanjooRazor.Pages
}
string metre = Request.Query["v"];
- int poetId = string.IsNullOrEmpty(Request.Query["a"]) ? 0 : int.Parse(Request.Query["a"]);
+ int? poetId = string.IsNullOrEmpty(Request.Query["a"]) ? null : int.Parse(Request.Query["a"]);
var poemsRes = await _ganjoorService.GetSimilarPoems
(
@@ -39,12 +39,12 @@ namespace GanjooRazor.Pages
PageSize = 20
},
metre: metre,
- rhyme: null,
+ rhyme: "",
poetId: poetId
);
GanjoorPage.Title = "شعرهای ";
- if (poetId != 0)
+ if (poetId != null)
{
GanjoorPage.Title += $"{Poets.Where(p => p.Id == poetId).Single().Name} ";
}
@@ -56,7 +56,7 @@ namespace GanjooRazor.Pages
string htmlText = "";
- if (poetId != 0)
+ if (poetId != null)
{
htmlText += $"{Environment.NewLine}";
htmlText += $"
{Environment.NewLine}";
diff --git a/GanjoorService.sln b/GanjoorService.sln
index 9d547aae..3bdacee2 100644
--- a/GanjoorService.sln
+++ b/GanjoorService.sln
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RSecurityBackend", "RSecuri
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RMuseum", "RMuseum\RMuseum.csproj", "{113EF3DE-E8A9-40EF-9DA0-8DFABB3CDD68}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GanjooRazor", "GanjooRazor\GanjooRazor.csproj", "{48F9CDFA-625F-4743-BF21-BD556F6F33E8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GanjooRazor", "GanjooRazor\GanjooRazor.csproj", "{48F9CDFA-625F-4743-BF21-BD556F6F33E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution