mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 11:41:30 +00:00
Refactor error modal into its own partial (#785)
* Refactor error modal into its own partial * Fix unresolved error string in TwoFactorPartial * Use tuple model instead of ViewData for error title and message * Apply suggestions from code review
This commit is contained in:
parent
af6fdb457b
commit
77e46a0721
8 changed files with 68 additions and 94 deletions
|
@ -12,12 +12,7 @@
|
|||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
|
||||
<form class="ui form" onsubmit="return onSubmit(this)" method="post">
|
||||
|
|
|
@ -29,21 +29,16 @@
|
|||
|
||||
<div class="ui middle aligned center aligned grid">
|
||||
<form class="ui form" onsubmit="return onSubmit(this)" method="post">
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" id="redirect" name="redirect">
|
||||
|
||||
|
||||
<div class="column">
|
||||
<h2 class="ui black image header centered">
|
||||
<img src="~/@(ServerConfiguration.Instance.WebsiteConfiguration.PrideEventEnabled && DateTime.Now.Month == 6 ? "logo-pride.png" : "logo-color.png")"
|
||||
<img src="~/@(ServerConfiguration.Instance.WebsiteConfiguration.PrideEventEnabled && DateTime.Now.Month == 6 ? "logo-pride.png" : "logo-color.png")"
|
||||
alt="Instance logo"
|
||||
class="image"
|
||||
style="width: 128px;"/>
|
||||
|
@ -84,7 +79,7 @@
|
|||
@Model.Translate(GeneralStrings.ForgotPassword)
|
||||
</div>
|
||||
</a>
|
||||
|
||||
|
||||
@if (ServerConfiguration.Instance.Authentication.RegistrationEnabled)
|
||||
{
|
||||
<div class="ui divider"></div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@page "/passwordReset"
|
||||
@using LBPUnion.ProjectLighthouse.Configuration
|
||||
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login.PasswordResetPage
|
||||
|
||||
|
@ -27,46 +26,41 @@
|
|||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p>@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
|
||||
<div class="ui middle aligned center aligned grid">
|
||||
<form onsubmit="return onSubmit(this)" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
<form onsubmit="return onSubmit(this)" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="column">
|
||||
<h2 class="ui black image header centered">
|
||||
<div class="content">
|
||||
@Model.Title
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
<div class="ui form">
|
||||
<div class="ui field">
|
||||
<label>Password</label>
|
||||
<div class="ui left icon input">
|
||||
<input type="password" id="password" placeholder="Password" >
|
||||
<input type="hidden" name="password" id="password-submit">
|
||||
<i class="lock icon"></i>
|
||||
<div class="column">
|
||||
<h2 class="ui black image header centered">
|
||||
<div class="content">
|
||||
@Model.Title
|
||||
</div>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
<div class="ui field">
|
||||
<label>Confirm Password</label>
|
||||
<div class="ui left icon input">
|
||||
<input type="password" id="confirmPassword" placeholder="Confirm Password">
|
||||
<input type="hidden" name="confirmPassword" id="confirmPassword-submit">
|
||||
<i class="lock icon"></i>
|
||||
<div class="ui form">
|
||||
<div class="ui field">
|
||||
<label>Password</label>
|
||||
<div class="ui left icon input">
|
||||
<input type="password" id="password" placeholder="Password">
|
||||
<input type="hidden" name="password" id="password-submit">
|
||||
<i class="lock icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui field">
|
||||
<label>Confirm Password</label>
|
||||
<div class="ui left icon input">
|
||||
<input type="password" id="confirmPassword" placeholder="Confirm Password">
|
||||
<input type="hidden" name="confirmPassword" id="confirmPassword-submit">
|
||||
<i class="lock icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" value="Reset password" id="submit" class="ui fluid blue button"><br>
|
||||
<div class="ui divider hidden"></div>
|
||||
</div>
|
||||
<input type="submit" value="Reset password" id="submit" class="ui fluid blue button"><br>
|
||||
<div class="ui divider hidden"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
|
@ -5,18 +5,13 @@
|
|||
@{
|
||||
Layout = "Layouts/BaseLayout";
|
||||
Model.Title = "Password Reset";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Status))
|
||||
{
|
||||
<div class="ui positive message">
|
||||
|
@ -28,7 +23,7 @@
|
|||
}
|
||||
|
||||
<form class="ui form" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<input type="text" autocomplete="no" id="email" placeholder="@Model.Translate(GeneralStrings.Email)" name="email"/><br/><br/>
|
||||
<input type="submit" value="Request Password Reset" class="ui blue button"/>
|
||||
|
|
|
@ -25,17 +25,14 @@
|
|||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p>@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
|
||||
@if (Model.Username == null)
|
||||
{
|
||||
<p><b>@Model.Translate(RegisterStrings.UsernameNotice)</b></p>
|
||||
<p>
|
||||
<b>@Model.Translate(RegisterStrings.UsernameNotice)</b>
|
||||
</p>
|
||||
}
|
||||
|
||||
<form class="ui form" onsubmit="return onSubmit(this)" method="post">
|
||||
|
|
|
@ -9,17 +9,12 @@
|
|||
|
||||
<form method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Error</p>
|
||||
</div>
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", (Model.Translate(GeneralStrings.Error), Model.Error), ViewData)
|
||||
}
|
||||
|
||||
|
||||
<input type="hidden" name="type" value="@((int)Model.Type)"/>
|
||||
<input type="hidden" name="affectedId" value="@Model.AffectedId"/>
|
||||
|
||||
|
@ -27,7 +22,7 @@
|
|||
<label for="reason" class="ui blue label">Reason: </label>
|
||||
<input type="text" name="reason" id="reason"/>
|
||||
</div><br/><br/>
|
||||
|
||||
|
||||
<div class="ui left labeled input">
|
||||
<label for="mod-notes" class="ui blue label">Mod Notes: </label>
|
||||
<input type="text" name="modNotes" id="mod-notes"/>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
@model (string Title, string Message)
|
||||
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Title
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Message</p>
|
||||
</div>
|
|
@ -10,14 +10,9 @@
|
|||
@Html.AntiForgeryToken()
|
||||
<div class="digits" id="2fa">
|
||||
@if (!string.IsNullOrWhiteSpace(error))
|
||||
{
|
||||
<div class="ui negative message">
|
||||
<div class="header">
|
||||
@Model.Translate(GeneralStrings.Error)
|
||||
</div>
|
||||
<p style="white-space: pre-line">@Model.Error</p>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
@await Html.PartialAsync("Partials/ErrorModalPartial", ((string)Model.Translate(GeneralStrings.Error), error), ViewData)
|
||||
}
|
||||
<input type="text" pattern="\d*" maxlength="1" id="digit1"/>
|
||||
<input type="text" pattern="\d*" maxlength="1" id="digit2"/>
|
||||
<input type="text" pattern="\d*" maxlength="1" id="digit3" class="middleDigit"/>
|
||||
|
@ -45,16 +40,16 @@
|
|||
|
||||
@if (allowBackupCodes)
|
||||
{
|
||||
<text>
|
||||
document.getElementById("backup-link").addEventListener("click", function (){
|
||||
let backupInput = document.getElementById("backup");
|
||||
if (backupInput.style.display === "none"){
|
||||
backupInput.style.display = "";
|
||||
} else {
|
||||
backupInput.style.display = "none";
|
||||
}
|
||||
});
|
||||
</text>
|
||||
<text>
|
||||
document.getElementById("backup-link").addEventListener("click", function (){
|
||||
let backupInput = document.getElementById("backup");
|
||||
if (backupInput.style.display === "none"){
|
||||
backupInput.style.display = "";
|
||||
} else {
|
||||
backupInput.style.display = "none";
|
||||
}
|
||||
});
|
||||
</text>
|
||||
}
|
||||
|
||||
document.querySelector(".digits").addEventListener("keydown", function(event){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue