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){