feat:이메일 및 아이디 로그인 지원

- 이메일 또는 아이디로 로그인 가능
- 아이디 로그인은 본사(HQ) 소속 직원만 허용
- LoginRequest에 isEmail(), getLoginField(), getCredentials() 메서드 추가
- AuthService.login()에 loginField 파라미터 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
pro
2026-01-27 16:49:15 +09:00
parent 66b8699fb2
commit 331253a5f7
4 changed files with 72 additions and 19 deletions

View File

@@ -28,13 +28,16 @@ public function showLoginForm(): View
/**
* 로그인 처리
* - 이메일 또는 아이디로 로그인 가능
* - 아이디 로그인은 본사 소속만 허용
*/
public function login(LoginRequest $request): RedirectResponse
{
$credentials = $request->only('email', 'password');
$credentials = $request->getCredentials();
$loginField = $request->getLoginField();
$remember = $request->boolean('remember', false);
if ($this->authService->login($credentials, $remember)) {
if ($this->authService->login($credentials, $remember, $loginField)) {
$request->session()->regenerate();
return redirect()->intended('/dashboard')
@@ -43,11 +46,11 @@ public function login(LoginRequest $request): RedirectResponse
// AuthService에서 설정한 오류 메시지 사용
$errorMessage = $this->authService->getLoginError()
?? '이메일 또는 비밀번호가 올바르지 않습니다.';
?? '이메일/아이디 또는 비밀번호가 올바르지 않습니다.';
return back()
->withErrors(['email' => $errorMessage])
->withInput($request->only('email'));
->withErrors(['login' => $errorMessage])
->withInput($request->only('login'));
}
/**