♻️ Move most of models to the Shared package
This commit is contained in:
@ -6,12 +6,12 @@ namespace DysonNetwork.Sphere.Pages.Account;
|
||||
|
||||
public class ProfileModel : PageModel
|
||||
{
|
||||
public DysonNetwork.Sphere.Account.Account? Account { get; set; }
|
||||
public DysonNetwork.Shared.Models.Account? Account { get; set; }
|
||||
public string? AccessToken { get; set; }
|
||||
|
||||
public Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser)
|
||||
if (HttpContext.Items["CurrentUser"] is not DysonNetwork.Shared.Models.Account currentUser)
|
||||
return Task.FromResult<IActionResult>(RedirectToPage("/Auth/Login"));
|
||||
|
||||
Account = currentUser;
|
||||
|
@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using DysonNetwork.Sphere.Auth.OidcProvider.Services;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DysonNetwork.Sphere.Auth;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Sphere.Auth.OidcProvider.Responses;
|
||||
using DysonNetwork.Sphere.Developer;
|
||||
|
||||
@ -48,7 +48,7 @@ public class AuthorizeModel(OidcProviderService oidcService, IConfiguration conf
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
// First check if user is authenticated
|
||||
if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser)
|
||||
if (HttpContext.Items["CurrentUser"] is not DysonNetwork.Shared.Models.Account currentUser)
|
||||
{
|
||||
var returnUrl = Uri.EscapeDataString($"{Request.Path}{Request.QueryString}");
|
||||
return RedirectToPage("/Auth/Login", new { returnUrl });
|
||||
@ -109,7 +109,7 @@ public class AuthorizeModel(OidcProviderService oidcService, IConfiguration conf
|
||||
return Page();
|
||||
}
|
||||
|
||||
private async Task<IActionResult> HandleApproval(Sphere.Account.Account currentUser, CustomApp client, Session? existingSession = null)
|
||||
private async Task<IActionResult> HandleApproval(DysonNetwork.Shared.Models.Account currentUser, CustomApp client, Session? existingSession = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(RedirectUri))
|
||||
{
|
||||
@ -161,7 +161,7 @@ public class AuthorizeModel(OidcProviderService oidcService, IConfiguration conf
|
||||
|
||||
public async Task<IActionResult> OnPostAsync(bool allow)
|
||||
{
|
||||
if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser) return Unauthorized();
|
||||
if (HttpContext.Items["CurrentUser"] is not DysonNetwork.Shared.Models.Account currentUser) return Unauthorized();
|
||||
|
||||
// First, validate the client ID
|
||||
if (string.IsNullOrEmpty(ClientIdString) || !Guid.TryParse(ClientIdString, out var clientId))
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Sphere.Auth;
|
||||
using DysonNetwork.Sphere.Account;
|
||||
using DysonNetwork.Sphere.Connection;
|
||||
|
@ -1,4 +1,5 @@
|
||||
@page "/web/auth/challenge/{id:guid}/select-factor"
|
||||
@using DysonNetwork.Shared.Models
|
||||
@using DysonNetwork.Sphere.Account
|
||||
@model DysonNetwork.Sphere.Pages.Auth.SelectFactorModel
|
||||
@{
|
||||
|
@ -1,3 +1,4 @@
|
||||
using DysonNetwork.Shared.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -1,4 +1,5 @@
|
||||
@page "/web/auth/challenge/{id:guid}/verify/{factorId:guid}"
|
||||
@using DysonNetwork.Shared.Models
|
||||
@using DysonNetwork.Sphere.Account
|
||||
@model DysonNetwork.Sphere.Pages.Auth.VerifyFactorModel
|
||||
@{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
Reference in New Issue
Block a user