- ITokenStore, IEmailService 인터페이스 정의 - InMemoryTokenStore (IMemoryCache 기반), ConsoleEmailService (로그 출력) 구현 - SignupAsync에 6자리 인증 코드 생성/저장/발송 로직 추가 - VerifyEmailAsync 구현 (코드 검증 → EmailVerified 업데이트) - POST /v1/in/auth/email/verify 엔드포인트 추가 - DI 등록 (ITokenStore, IEmailService, MemoryCache)
31 lines
862 B
C#
31 lines
862 B
C#
using Microsoft.Extensions.Logging;
|
|
using SPMS.Application.Interfaces;
|
|
|
|
namespace SPMS.Infrastructure.Services;
|
|
|
|
public class ConsoleEmailService : IEmailService
|
|
{
|
|
private readonly ILogger<ConsoleEmailService> _logger;
|
|
|
|
public ConsoleEmailService(ILogger<ConsoleEmailService> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public Task SendVerificationCodeAsync(string email, string code)
|
|
{
|
|
_logger.LogInformation(
|
|
"[EMAIL] 이메일 인증 코드 발송 → To: {Email}, Code: {Code}",
|
|
email, code);
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task SendPasswordResetTokenAsync(string email, string token)
|
|
{
|
|
_logger.LogInformation(
|
|
"[EMAIL] 비밀번호 재설정 토큰 발송 → To: {Email}, Token: {Token}",
|
|
email, token);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|