docs: fixing login partial problem

This commit is contained in:
Hamid Reza Mohammadi 2022-01-23 09:25:25 +03:30
parent 3a90b0be22
commit 7fcd37ea1d
9 changed files with 26 additions and 130 deletions

View File

@ -27,7 +27,7 @@ using System.Threading.Tasks;
namespace GanjooRazor.Pages
{
[IgnoreAntiforgeryToken(Order = 1001)]
public partial class IndexModel : PageModel
public partial class IndexModel : LoginPartialEnabledPageModel
{
/// <summary>
/// configration file reader (appsettings.json)
@ -78,8 +78,7 @@ namespace GanjooRazor.Pages
_memoryCache = memoryCache;
}
[BindProperty]
public LoginViewModel LoginViewModel { get; set; }
/// <summary>
/// last error
@ -382,10 +381,7 @@ namespace GanjooRazor.Pages
/// </summary>
public bool IsPoemPage { get; set; }
/// <summary>
/// is logged on
/// </summary>
public bool LoggedIn { get; set; }
/// <summary>
/// can edit

View File

@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using RSecurityBackend.Models.Auth.ViewModels;
namespace GanjooRazor.Pages
{
public class LoginPartialEnabledPageModel : PageModel
{
/// <summary>
/// is logged on
/// </summary>
public bool LoggedIn { get; set; }
[BindProperty]
public LoginViewModel LoginViewModel { get; set; }
}
}

View File

@ -180,7 +180,7 @@
</div>
<partial name="_InlineLoginPartialForSearch" model="Model" />
<partial name="_InlineLoginPartial" model="Model" />
<partial name="_FooterPartial" model="null" />

View File

@ -27,7 +27,7 @@ namespace GanjooRazor.Pages
{
[IgnoreAntiforgeryToken(Order = 1001)]
public class SearchModel : PageModel
public class SearchModel : LoginPartialEnabledPageModel
{
/// <summary>
/// HttpClient instance
@ -86,14 +86,6 @@ namespace GanjooRazor.Pages
public List<GanjoorPoemCompleteViewModel> Poems { get; set; }
public string PagingToolsHtml { get; set; }
/// <summary>
/// is logged on
/// </summary>
public bool LoggedIn { get; set; }
[BindProperty]
public LoginViewModel LoginViewModel { get; set; }
public string LastError { get; set; }
private async Task<bool> preparePoets()

View File

@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace GanjooRazor.Pages
{
public partial class IndexModel : PageModel
public partial class IndexModel : LoginPartialEnabledPageModel
{
/// <summary>
/// صفحهٔ حاشیه‌ها

View File

@ -1,4 +1,4 @@
@model GanjooRazor.Pages.IndexModel
@model GanjooRazor.Pages.LoginPartialEnabledPageModel
@if (Model.LoggedIn)
{

View File

@ -1,109 +0,0 @@
@model GanjooRazor.Pages.SearchModel
@if (Model.LoggedIn)
{
<div class="fab">
<span class="fab-action-button">
<i class="fab-action-button-loggedin__icon"></i>
</span>
<ul class="fab-buttons">
<li class="fab-buttons__item">
<a asp-page="Index" asp-area="User" class="fab-buttons__link" data-tooltip="پیشخان">
<i class="icon-material icon-material_panel"></i>
</a>
</li>
<li class="fab-buttons__item">
<form method="post" id="logoutform" action="?handler=Logout">
</form>
<a href="javascript:document.getElementById('logoutform').submit();" class="fab-buttons__link" data-tooltip="خروج">
<i class="icon-material icon-material_exit"></i>
</a>
</li>
</ul>
</div>
}
else
{
<div class="fab">
<span class="fab-action-button">
<a role="button" class="actionlink" onclick="document.getElementById('id01').style.display='block'" data-tooltip="ورود کاربر" title="ورود کاربر">
<i class="fab-action-button__icon"></i>
</a>
</span>
</div>
<!-- The Modal -->
<div id="id01" class="modal">
<span onclick="document.getElementById('id01').style.display='none'"
class="close" title="بستن">&times;</span>
<!-- Modal Content -->
<form class="modal-content animate" method="post" action="?handler=Login">
<div class="imgcontainer">
<img src="/image/login.png" alt="گنجور" class="avatar">
</div>
<table style="width:100%">
<tr>
<td colspan="2">
<h2>
ورود به گنجور
</h2>
</td>
</tr>
<tr>
<td>
<span class="inputlabel">پست الکترونیکی: </span>
</td>
<td>
<input type="email" style="text-align:left;direction:ltr;width:100%" placeholder="پست الکترونیکی" asp-for="LoginViewModel.Username" />
</td>
</tr>
<tr>
<td>
<span class="inputlabel">گذرواژه: </span>
</td>
<td>
<input type="password" id="password" style="text-align:left;direction:ltr;width:100%" placeholder="گذرواژه" asp-for="LoginViewModel.Password" />
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" style="width:100%;cursor:pointer" id="submit" value="ورود" /></td>
</tr>
<tr>
<td></td>
<td>
<table style="width:100%; margin:0">
<tr>
<td>
<input type="button" onclick="location.href='/signup'" class="cancelbtn" style="width:100%;text-align:center;cursor:pointer" value="ثبت نام" />
</td>
<td>
<input type="button" onclick="location.href='/resetpassword'" class="cancelbtn" style="width:100%;text-align:center;cursor:pointer" value="فراموشی رمز" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" onclick="document.getElementById('id01').style.display='none'" style="width: 100%; text-align: center; cursor: pointer" value="انصراف" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<p>
اگر پیشتر در <a href="https://museum.ganjoor.net" target="_blank">گنجینه</a> یا <a href="https://gaudiopanel.ganjoor.net" target="_blank">پیشخان خوانشگران</a> گنجور ثبت نام کرده‌اید می‌توانید با همان اطلاعات کاربری به گنجور وارد شوید.
</p>
</td>
</tr>
</table>
</form>
</div>
}

View File

@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace GanjooRazor.Pages
{
public partial class IndexModel : PageModel
public partial class IndexModel : LoginPartialEnabledPageModel
{
/// <summary>
/// اشعار مشابه

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace GanjooRazor.Pages
{
public partial class IndexModel : PageModel
public partial class IndexModel : LoginPartialEnabledPageModel
{
/// <summary>
/// صفحهٔ اشعار با وزن خاص