From 8aed0e8f1c8bfabd1f18a1e956a0e8d73e2fbd0d Mon Sep 17 00:00:00 2001 From: hen715 Date: Tue, 23 Jul 2024 18:07:02 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20=ED=95=99=EA=B5=90=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=EB=B2=A0=EC=9D=B4=EC=8A=A4=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EB=AC=B8=EC=A0=9C=EB=A1=9C=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=A1=B0=EC=B9=98=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inuportal/service/MemberService.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/kr/inuappcenterportal/inuportal/service/MemberService.java b/src/main/java/kr/inuappcenterportal/inuportal/service/MemberService.java index d86a7ca..e6d0474 100644 --- a/src/main/java/kr/inuappcenterportal/inuportal/service/MemberService.java +++ b/src/main/java/kr/inuappcenterportal/inuportal/service/MemberService.java @@ -98,21 +98,15 @@ public List getAllMember(){ @Transactional public TokenDto schoolLogin(LoginDto loginDto){ - //서버 관련 문제로 일시적 관리자 로그인 추가 - if(memberRepository.existsByStudentId(loginDto.getStudentId()) && memberRepository.findByStudentId(loginDto.getStudentId()).get().getRoles().get(0).equals("ROLE_ADMIN")){ - Member member = memberRepository.findByStudentId(loginDto.getStudentId()).get(); - return login(member); + if (!schoolLoginRepository.loginCheck(loginDto.getStudentId(), loginDto.getPassword())) { + throw new MyException(MyErrorCode.STUDENT_LOGIN_ERROR); } - else { - if (!schoolLoginRepository.loginCheck(loginDto.getStudentId(), loginDto.getPassword())) { - throw new MyException(MyErrorCode.STUDENT_LOGIN_ERROR); - } - if (!memberRepository.existsByStudentId(loginDto.getStudentId())) { - createMember(loginDto.getStudentId()); - } - Member member = memberRepository.findByStudentId(loginDto.getStudentId()).orElseThrow(() -> new MyException(MyErrorCode.USER_NOT_FOUND)); - return login(member); + if (!memberRepository.existsByStudentId(loginDto.getStudentId())) { + createMember(loginDto.getStudentId()); } + Member member = memberRepository.findByStudentId(loginDto.getStudentId()).orElseThrow(() -> new MyException(MyErrorCode.USER_NOT_FOUND)); + return login(member); + } @Transactional public void createMember(String studentId){