-
Notifications
You must be signed in to change notification settings - Fork 10
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
[6주차 과제] 서예원 과제 제출합니다. #11
base: yewon
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Sat Aug 17 21:59:44 KST 2024 | ||
gradle.version=7.6.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE HTML> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<div class="container"> | ||
<div> | ||
<h1><span th:text="${name}"/>의 블로그</h1> | ||
</div> | ||
</div> <!-- /container --> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<div class="container"> | ||
<form action="/members/login" method="post"> | ||
<div class="form-group"> | ||
<label for="email">이메일</label> | ||
<input type="text" id="email" name="email" placeholder="이메일을 입력하세요"> | ||
<br> | ||
<label for="password">비밀번호</label> | ||
<input type="text" id="password" name="password" placeholder="비밀번호를 입력하세요"> | ||
</div> | ||
<button type="submit">로그인</button> | ||
</form> | ||
</div> <!-- /container --> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,15 @@ public Optional<Member> findByName(String name) { | |
.findAny(); | ||
} | ||
|
||
public Optional<Member> findByEmail(String email) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. emal이 중복된 사용자가 있으면 어떡하죠? findAny()는 너무 무책임한것 같습니다아 |
||
return store.values().stream() | ||
.filter(member -> member.getEmail().equals(email)) | ||
.findAny(); | ||
} | ||
|
||
public boolean validatePwd(Long id, String pwd) { | ||
return store.get(id) != null && store.get(id).getPwd().equals(pwd); | ||
} | ||
@Override | ||
public List<Member> findAll() { | ||
return new ArrayList<>(store.values()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,18 @@ private void validateDuplicateMember(Member member) { | |
}); | ||
} | ||
|
||
|
||
public Optional<Member> findByEmail(String email) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. validateDuplicateMember를 보고 이메일 중복 검증을 추가해보세요~~ |
||
return memberRepository.findByEmail(email); | ||
} | ||
|
||
|
||
|
||
public Optional<Member> findById(Long memberId) { | ||
return memberRepository.findById(memberId); | ||
} | ||
|
||
|
||
public List<Member> findMembers() { | ||
return memberRepository.findAll(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE HTML> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<div class="container"> | ||
<div> | ||
<h1><span th:text="${name}"/>의 블로그</h1> | ||
</div> | ||
</div> <!-- /container --> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<body> | ||
<div class="container"> | ||
<form action="/members/login" method="post"> | ||
<div class="form-group"> | ||
<label for="email">이메일</label> | ||
<input type="text" id="email" name="email" placeholder="이메일을 입력하세요"> | ||
<br> | ||
<label for="password">비밀번호</label> | ||
<input type="text" id="password" name="password" placeholder="비밀번호를 입력하세요"> | ||
</div> | ||
<button type="submit">로그인</button> | ||
</form> | ||
</div> <!-- /container --> | ||
</body> | ||
</html> |
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.
service 클래스를 만들었네요~~ 사용자가 회원가입을 하는건 비즈니스 로직 아닐까요? Service를 만든김에 사용자 생성을 service 클래스에서 해보세요~~