-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: [회원 관리] 로그인 컴포넌트 #72
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3bf653d
refactor: CategoryParamList 명명 수정
lxxjn0 d55878f
feat: 로그인 화면 컴포넌트 작성
lxxjn0 044f06d
refactor: primary 컬러 적용
lxxjn0 5febde4
refactor: 코드 포맷팅 적용
lxxjn0 a00f0f9
refactor: h2 database 설정 변경
lxxjn0 952b08f
refactor: member 엔티티 수정
lxxjn0 5bcd650
feat: login 인수 테스트 작성
lxxjn0 c85cd99
feat: MemberService의 login 메서드 구현
lxxjn0 d1263f6
feat: MemberControllerTest, MemberAcceptanceTest 구현
lxxjn0 1acad3a
test: test 환경 설정
lxxjn0 1733032
feat: 프론트에 api 호출 메서드 적용
lxxjn0 10059d5
feat: logging 설정 파일 추가
lxxjn0 5049b8d
feat: login 버튼 클릭 시 보이는 LoginVerifyModal 구현
lxxjn0 902d005
refactor: 불필요한 주석 제거 및 생성자 접근 지정자 수정
lxxjn0 a56e8c1
refactor: 부족한 MemberServiceTest와 LoginAdviceControllerTest 작성
lxxjn0 f55879c
Merge remote-tracking branch 'origin/develop' into feature/63
lxxjn0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
back/src/main/java/sellerlee/back/config/H2ServerConfig.java
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
back/src/main/java/sellerlee/back/member/application/MemberLoginRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @author lxxjn0 | ||
*/ | ||
|
||
package sellerlee.back.member.application; | ||
|
||
public class MemberLoginRequest { | ||
private String email; | ||
private String password; | ||
|
||
private MemberLoginRequest() { | ||
} | ||
|
||
public MemberLoginRequest(String email, String password) { | ||
this.email = email; | ||
this.password = password; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
back/src/main/java/sellerlee/back/member/application/MemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @author lxxjn0 | ||
*/ | ||
|
||
package sellerlee.back.member.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import sellerlee.back.member.domain.IllegalMemberLoginException; | ||
import sellerlee.back.member.domain.Member; | ||
import sellerlee.back.member.domain.MemberRepository; | ||
|
||
@Service | ||
public class MemberService { | ||
private final MemberRepository memberRepository; | ||
|
||
public MemberService(MemberRepository memberRepository) { | ||
this.memberRepository = memberRepository; | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public void login(MemberLoginRequest request) { | ||
Member findMember = memberRepository.findMemberByEmail(request.getEmail()) | ||
.orElseThrow(() -> new IllegalMemberLoginException("이메일이 일치하는 회원이 존재하지 않습니다.")); | ||
|
||
if (!findMember.verify(request.getPassword())) { | ||
throw new IllegalMemberLoginException("비밀번호가 일치하지 않습니다."); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
back/src/main/java/sellerlee/back/member/domain/IllegalMemberLoginException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @author lxxjn0 | ||
*/ | ||
|
||
package sellerlee.back.member.domain; | ||
|
||
public class IllegalMemberLoginException extends IllegalArgumentException { | ||
public IllegalMemberLoginException(String s) { | ||
super(s); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
back/src/main/java/sellerlee/back/member/domain/MemberRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @author lxxjn0 | ||
*/ | ||
|
||
package sellerlee.back.member.domain; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MemberRepository extends JpaRepository<Member, Long> { | ||
Optional<Member> findMemberByEmail(String email); | ||
} |
17 changes: 17 additions & 0 deletions
17
back/src/main/java/sellerlee/back/member/presentation/LoginAdviceController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package sellerlee.back.member.presentation; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
import sellerlee.back.member.domain.IllegalMemberLoginException; | ||
|
||
@ControllerAdvice | ||
public class LoginAdviceController { | ||
@ExceptionHandler(IllegalMemberLoginException.class) | ||
public ResponseEntity<String> handleIllegalMemberLoginException(IllegalMemberLoginException e) { | ||
return ResponseEntity | ||
.badRequest() | ||
.body(e.getMessage()); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
back/src/main/java/sellerlee/back/member/presentation/MemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @author lxxjn0 | ||
*/ | ||
|
||
package sellerlee.back.member.presentation; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import sellerlee.back.member.application.MemberLoginRequest; | ||
import sellerlee.back.member.application.MemberService; | ||
|
||
@RestController | ||
public class MemberController { | ||
private final MemberService memberService; | ||
|
||
public MemberController(MemberService memberService) { | ||
this.memberService = memberService; | ||
} | ||
|
||
@PostMapping("/login") | ||
public ResponseEntity<Void> login(@RequestBody MemberLoginRequest request) { | ||
memberService.login(request); | ||
|
||
return ResponseEntity | ||
.ok() | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
/** | ||
* @author begaonnuri | ||
* @author kouz95 | ||
*/ | ||
|
||
insert into member (member_id, email, password, score) | ||
values (1, 'turtle@woowabro.com', '1234', 36); | ||
values (1, 'turtle@woowabro.com', '1234', 36), | ||
(2, 'lxxjn0@gmail.com', '0000', 5.0), | ||
(3, 'sellerlee@gmail.com', '1234', 4.5); | ||
|
||
insert into article (article_id, category, contents, price, title, member_id) values (2, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (3, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (4, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (5, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (6, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (7, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (8, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (9, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (10, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (11, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) values (12, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
insert into article (article_id, category, contents, price, title, member_id) | ||
values (2, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(3, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(4, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(5, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(6, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(7, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(8, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(9, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(10, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(11, 'PC', 'test contents1', 1234, 'test title1', 1), | ||
(12, 'PC', 'test contents1', 1234, 'test title1', 1); | ||
|
||
insert into tag (article_id, name) | ||
values (1, 'test tag1'), | ||
(1, 'test tag2'), | ||
(2, 'test tag3'), | ||
(2, 'test tag4'); | ||
values (2, 'test tag1'), | ||
(2, 'test tag2'), | ||
(3, 'test tag3'), | ||
(3, 'test tag4'); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍