57269e281d
TaxBaik CI/CD / build-and-deploy (push) Failing after 36s
분리의 단점을 제거하고 단일 앱으로 통합: 구조 변경: - TaxBaik.Admin → TaxBaik.Web/Components/Admin/ - Admin Services → TaxBaik.Web/Services/ - 포트: 5001 (기존 5002 제거) 경로: - 홈페이지: http://localhost:5001/taxbaik - 관리자: http://localhost:5001/taxbaik/admin 기술: - Razor Pages (Web) + Blazor Server (Admin) 통합 - 단일 Program.cs로 양쪽 모두 지원 - JWT 인증 유지 - MudBlazor UI 유지 장점: - 개발 복잡도 감소 (터미널 1개) - 배포 단순화 (앱 1개) - DB 마이그레이션 1회 실행 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
86 lines
2.8 KiB
Plaintext
86 lines
2.8 KiB
Plaintext
@page "/admin/login"
|
|
@using System.ComponentModel.DataAnnotations
|
|
@layout TaxBaik.Web.Components.Admin.Layout.BlankLayout
|
|
@attribute [AllowAnonymous]
|
|
@inject AuthService AuthService
|
|
@inject NavigationManager NavigationManager
|
|
@inject CustomAuthenticationStateProvider AuthStateProvider
|
|
|
|
<PageTitle>로그인</PageTitle>
|
|
|
|
<MudContainer MaxWidth="MaxWidth.Small" Class="d-flex align-center justify-center" Style="min-height: 100vh;">
|
|
<MudPaper Class="pa-8" Elevation="3" Style="width: 100%; max-width: 400px;">
|
|
<MudText Typo="Typo.h4" Class="mb-6 text-center">관리자 로그인</MudText>
|
|
|
|
<MudForm @ref="form" @bind-IsValid="@isFormValid">
|
|
<MudTextField @bind-Value="model.Username" Label="사용자명"
|
|
Variant="Variant.Outlined" Required="true" Class="mb-4" />
|
|
|
|
<MudTextField @bind-Value="model.Password" Label="비밀번호" InputType="InputType.Password"
|
|
Variant="Variant.Outlined" Required="true" Class="mb-4" />
|
|
|
|
@if (!string.IsNullOrEmpty(errorMessage))
|
|
{
|
|
<MudAlert Severity="Severity.Error" Class="mb-4">@errorMessage</MudAlert>
|
|
}
|
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true"
|
|
Size="Size.Large" OnClick="HandleLogin" Disabled="isLoading">
|
|
@if (isLoading)
|
|
{
|
|
<MudProgressCircular Size="Size.Small" Indeterminate="true" Class="mr-2" />
|
|
<span>로그인 중...</span>
|
|
}
|
|
else
|
|
{
|
|
<span>로그인</span>
|
|
}
|
|
</MudButton>
|
|
</MudForm>
|
|
</MudPaper>
|
|
</MudContainer>
|
|
|
|
@code {
|
|
private MudForm form;
|
|
private bool isFormValid = false;
|
|
private bool isLoading = false;
|
|
private string errorMessage = "";
|
|
|
|
private LoginModel model = new();
|
|
|
|
private async Task HandleLogin()
|
|
{
|
|
if (isLoading)
|
|
return;
|
|
|
|
isLoading = true;
|
|
errorMessage = "";
|
|
|
|
try
|
|
{
|
|
var token = await AuthService.AuthenticateAndGenerateTokenAsync(model.Username, model.Password);
|
|
|
|
if (token == null)
|
|
{
|
|
errorMessage = "사용자명 또는 비밀번호가 올바르지 않습니다.";
|
|
isLoading = false;
|
|
return;
|
|
}
|
|
|
|
await AuthStateProvider.LoginAsync(token);
|
|
NavigationManager.NavigateTo("/taxbaik/admin/dashboard", forceLoad: false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errorMessage = "로그인 중 오류가 발생했습니다.";
|
|
isLoading = false;
|
|
}
|
|
}
|
|
|
|
private class LoginModel
|
|
{
|
|
public string Username { get; set; } = "";
|
|
public string Password { get; set; } = "";
|
|
}
|
|
}
|