From 3539ebb60026d08362ad819042b631abe4603d17 Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 30 Jun 2017 15:47:39 +0900 Subject: [PATCH] member service signin method parameter modify --- .../com/loafle/overflow/module/member/dao/MemberDAO.java | 4 ++-- .../overflow/module/member/service/MemberService.java | 6 +++--- .../loafle/overflow/module/member/dao/MemberDAOTest.java | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java b/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java index 47cebbe..334b5e7 100644 --- a/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java +++ b/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java @@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository; */ @Repository public interface MemberDAO extends JpaRepository { - @Query("select m from Member m WHERE m.email = :#{#m2.email}") - Member findByEmail(@Param("m2") Member member); + @Query("select m from Member m WHERE m.email = :signinId") + Member findByEmail(@Param("signinId") String signinId); } diff --git a/src/main/java/com/loafle/overflow/module/member/service/MemberService.java b/src/main/java/com/loafle/overflow/module/member/service/MemberService.java index 02d3647..64dd970 100644 --- a/src/main/java/com/loafle/overflow/module/member/service/MemberService.java +++ b/src/main/java/com/loafle/overflow/module/member/service/MemberService.java @@ -15,8 +15,8 @@ public class MemberService { @Autowired private MemberDAO memberDAO; - public Member signin(Member member) throws Exception { - Member m = this.memberDAO.findByEmail(member); + public Member signin(String signinId, String signinPw) throws Exception { + Member m = this.memberDAO.findByEmail(signinId); if ( null == m ) { return m; @@ -27,7 +27,7 @@ public class MemberService { } BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - Boolean match = passwordEncoder.matches(member.getPw(), m.getPw()); + Boolean match = passwordEncoder.matches(signinPw, m.getPw()); if(!match) return null; return m; diff --git a/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java b/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java index 249fb50..75c355b 100644 --- a/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java +++ b/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java @@ -4,6 +4,7 @@ import com.loafle.overflow.module.member.model.Member; import com.loafle.overflow.module.meta.model.MetaMemberStatus; import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.JdbcConfiguration; +import com.loafle.overflow.spring.MailConfiguration; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -17,7 +18,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @Ignore @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) public class MemberDAOTest { @Autowired @@ -41,7 +42,7 @@ public class MemberDAOTest { Member member = new Member(1); member.setEmail("overflow@loafle.com"); - Member rr = repo.findByEmail(member); + Member rr = repo.findByEmail("overflow@loafle.com"); System.out.println("rr.getCompanyName() = " + rr.getCompanyName()); }