mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 18:18:39 +00:00
Make suggested changes
This commit is contained in:
parent
df7bb7d356
commit
32acd054f4
7 changed files with 18 additions and 16 deletions
|
@ -57,10 +57,6 @@ public class ResourcesController : ControllerBase
|
||||||
{
|
{
|
||||||
string path = $"png/{hash}.png";
|
string path = $"png/{hash}.png";
|
||||||
|
|
||||||
if (!IOFile.Exists("png"))
|
|
||||||
{
|
|
||||||
FileHelper.EnsureDirectoryCreated(Path.Combine(Environment.CurrentDirectory, "png"));
|
|
||||||
}
|
|
||||||
if (IOFile.Exists(path))
|
if (IOFile.Exists(path))
|
||||||
{
|
{
|
||||||
return this.File(IOFile.OpenRead(path), "image/png");
|
return this.File(IOFile.OpenRead(path), "image/png");
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function onSubmit(form) {
|
function onSubmit(form) {
|
||||||
const passwordHashed = document.getElementById("password");
|
const passwordInput = document.getElementById("password");
|
||||||
const passwordOriginal = document.getElementById("password-original");
|
const passwordSubmit = document.getElementById("password-submit");
|
||||||
passwordHashed.value = sha256(passwordOriginal.value);
|
|
||||||
|
passwordSubmit.value = sha256(passwordInput);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,8 +44,8 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Password</label>
|
<label>Password</label>
|
||||||
<div class="ui left icon input">
|
<div class="ui left icon input">
|
||||||
<input type="password" id="password-original" placeholder="Password">
|
<input type="password" id="password" placeholder="Password">
|
||||||
<input type="hidden" name="password" id="password">
|
<input type="hidden" id="password-submit" name="password">
|
||||||
<i class="lock icon"></i>
|
<i class="lock icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -27,7 +28,7 @@ public class PhotosPage : BaseLayout
|
||||||
public PhotosPage([NotNull] Database database) : base(database)
|
public PhotosPage([NotNull] Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string name)
|
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name)) name = "";
|
if (string.IsNullOrWhiteSpace(name)) name = "";
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
function onSubmit(form) {
|
function onSubmit(form) {
|
||||||
const passwordInput = document.getElementById("password");
|
const passwordInput = document.getElementById("password");
|
||||||
const confirmPasswordInput = document.getElementById("confirmPassword");
|
const confirmPasswordInput = document.getElementById("confirmPassword");
|
||||||
const password = document.getElementById("password-submit");
|
const passwordSubmit = document.getElementById("password-submit");
|
||||||
const confirmPassword = document.getElementById("confirm-submit");
|
const confirmPasswordSubmit = document.getElementById("confirm-submit");
|
||||||
password.value = sha256(passwordInput.value);
|
passwordSubmit.value = sha256(passwordInput.value);
|
||||||
confirmPassword.value = sha256(confirmPasswordInput.value);
|
confirmPasswordSubmit.value = sha256(confirmPasswordInput.value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -28,7 +29,7 @@ public class SlotsPage : BaseLayout
|
||||||
public SlotsPage([NotNull] Database database) : base(database)
|
public SlotsPage([NotNull] Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string name)
|
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name)) name = "";
|
if (string.IsNullOrWhiteSpace(name)) name = "";
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -26,7 +27,7 @@ public class UsersPage : BaseLayout
|
||||||
public UsersPage([NotNull] Database database) : base(database)
|
public UsersPage([NotNull] Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string name)
|
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name)) name = "";
|
if (string.IsNullOrWhiteSpace(name)) name = "";
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ public class UsersPage : BaseLayout
|
||||||
this.SearchValue = name;
|
this.SearchValue = name;
|
||||||
this.PageNumber = pageNumber;
|
this.PageNumber = pageNumber;
|
||||||
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.UserCount / ServerStatics.PageSize));
|
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.UserCount / ServerStatics.PageSize));
|
||||||
|
|
||||||
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/users/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/users/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
||||||
|
|
||||||
this.Users = await this.Database.Users.Where
|
this.Users = await this.Database.Users.Where
|
||||||
|
|
|
@ -82,6 +82,7 @@ public static class Program
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileHelper.EnsureDirectoryCreated(Path.Combine(Environment.CurrentDirectory, "png"));
|
||||||
if (Directory.Exists("r"))
|
if (Directory.Exists("r"))
|
||||||
{
|
{
|
||||||
Logger.Log
|
Logger.Log
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue