Move all irrelevant Pages out of ExternalAuth

This commit is contained in:
jvyden 2021-11-22 18:37:26 -05:00
commit 4b69192e89
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
11 changed files with 31 additions and 12 deletions

View file

@ -14,8 +14,8 @@ using IOFile = System.IO.File;
namespace LBPUnion.ProjectLighthouse.Controllers namespace LBPUnion.ProjectLighthouse.Controllers
{ {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
[Route("LITTLEBIGPLANETPS3_XML")]
public class ResourcesController : ControllerBase public class ResourcesController : ControllerBase
{ {
[HttpPost("showModerated")] [HttpPost("showModerated")]
@ -39,6 +39,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
return this.Ok(LbpSerializer.StringElement("resources", resources)); return this.Ok(LbpSerializer.StringElement("resources", resources));
} }
[HttpGet("/gameAssets/{hash}")]
[HttpGet("r/{hash}")] [HttpGet("r/{hash}")]
public IActionResult GetResource(string hash) public IActionResult GetResource(string hash)
{ {

View file

@ -1,5 +1,5 @@
@page "/" @page "/"
@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.LandingPage @model LBPUnion.ProjectLighthouse.Pages.LandingPage
@{ @{
Layout = "Layouts/BaseLayout"; Layout = "Layouts/BaseLayout";

View file

@ -5,7 +5,7 @@ using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts; using LBPUnion.ProjectLighthouse.Pages.Layouts;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth namespace LBPUnion.ProjectLighthouse.Pages
{ {
public class LandingPage : BaseLayout public class LandingPage : BaseLayout
{ {

View file

@ -1,5 +1,5 @@
@page "/login" @page "/login"
@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.LoginForm @model LBPUnion.ProjectLighthouse.Pages.LoginForm
@{ @{
Layout = "Layouts/BaseLayout"; Layout = "Layouts/BaseLayout";

View file

@ -7,7 +7,7 @@ using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth namespace LBPUnion.ProjectLighthouse.Pages
{ {
public class LoginForm : BaseLayout public class LoginForm : BaseLayout
{ {
@ -19,9 +19,9 @@ namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
[UsedImplicitly] [UsedImplicitly]
public async Task<IActionResult> OnGet([FromQuery] string username, [FromQuery] string password) public async Task<IActionResult> OnGet([FromQuery] string username, [FromQuery] string password)
{ {
WasLoginRequest = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password); this.WasLoginRequest = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password);
if (WasLoginRequest) if (this.WasLoginRequest)
{ {
User? user = await this.Database.Users.FirstOrDefaultAsync(u => u.Username == username); User? user = await this.Database.Users.FirstOrDefaultAsync(u => u.Username == username);
if (user == null) return this.StatusCode(403, ""); if (user == null) return this.StatusCode(403, "");

View file

@ -1,5 +1,5 @@
@page "/logout" @page "/logout"
@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.LogoutPage @model LBPUnion.ProjectLighthouse.Pages.LogoutPage
@{ @{
Layout = "Layouts/BaseLayout"; Layout = "Layouts/BaseLayout";

View file

@ -4,7 +4,7 @@ using LBPUnion.ProjectLighthouse.Pages.Layouts;
using LBPUnion.ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth namespace LBPUnion.ProjectLighthouse.Pages
{ {
public class LogoutPage : BaseLayout public class LogoutPage : BaseLayout
{ {

View file

@ -0,0 +1,8 @@
@page
@model LBPUnion.ProjectLighthouse.Pages.PhotosPage
@{
Layout = "Layouts/BaseLayout";
}
<h1>Photos</h1>

View file

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace LBPUnion.ProjectLighthouse.Pages
{
public class PhotosPage : PageModel
{
public void OnGet()
{}
}
}

View file

@ -1,5 +1,5 @@
@page "/register" @page "/register"
@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.RegisterForm @model LBPUnion.ProjectLighthouse.Pages.RegisterForm
@{ @{
Layout = "Layouts/BaseLayout"; Layout = "Layouts/BaseLayout";

View file

@ -7,7 +7,7 @@ using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth namespace LBPUnion.ProjectLighthouse.Pages
{ {
public class RegisterForm : BaseLayout public class RegisterForm : BaseLayout
{ {
@ -22,7 +22,7 @@ namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
{ {
this.WasRegisterRequest = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword); this.WasRegisterRequest = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword);
if (WasRegisterRequest) if (this.WasRegisterRequest)
{ {
if (password != confirmPassword) return this.BadRequest(); if (password != confirmPassword) return this.BadRequest();