mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
Add option to disable registration
This commit is contained in:
parent
bccf7d2ecf
commit
9b73a94b65
3 changed files with 10 additions and 2 deletions
|
@ -7,7 +7,10 @@
|
|||
if (Model!.User == null)
|
||||
{
|
||||
Model.NavigationItemsRight.Add(new PageNavigationItem("Log in", "/login", "user alternate"));
|
||||
Model.NavigationItemsRight.Add(new PageNavigationItem("Register", "/register", "user alternate edit"));
|
||||
if (ServerSettings.Instance.RegistrationEnabled)
|
||||
{
|
||||
Model.NavigationItemsRight.Add(new PageNavigationItem("Register", "/register", "user alternate edit"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
|||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
@ -20,6 +21,8 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
|||
[SuppressMessage("ReSharper", "SpecifyStringComparison")]
|
||||
public async Task<IActionResult> OnGet([FromQuery] string username, [FromQuery] string password, [FromQuery] string confirmPassword)
|
||||
{
|
||||
if (!ServerSettings.Instance.RegistrationEnabled) return this.NotFound();
|
||||
|
||||
this.WasRegisterRequest = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword);
|
||||
|
||||
if (this.WasRegisterRequest)
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
|||
}
|
||||
}
|
||||
|
||||
public const int CurrentConfigVersion = 8; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE!
|
||||
public const int CurrentConfigVersion = 9; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE!
|
||||
|
||||
#region Meta
|
||||
|
||||
|
@ -93,5 +93,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
|||
public bool UseExternalAuth { get; set; }
|
||||
|
||||
public bool CheckForUnsafeFiles { get; set; } = true;
|
||||
|
||||
public bool RegistrationEnabled { get; set; } = true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue