member service signin method parameter modify
This commit is contained in:
parent
d05e2b1c0a
commit
3539ebb600
|
@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository;
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface MemberDAO extends JpaRepository<Member, Long> {
|
public interface MemberDAO extends JpaRepository<Member, Long> {
|
||||||
@Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
@Query("select m from Member m WHERE m.email = :signinId")
|
||||||
Member findByEmail(@Param("m2") Member member);
|
Member findByEmail(@Param("signinId") String signinId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ public class MemberService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberDAO memberDAO;
|
private MemberDAO memberDAO;
|
||||||
|
|
||||||
public Member signin(Member member) throws Exception {
|
public Member signin(String signinId, String signinPw) throws Exception {
|
||||||
Member m = this.memberDAO.findByEmail(member);
|
Member m = this.memberDAO.findByEmail(signinId);
|
||||||
|
|
||||||
if ( null == m ) {
|
if ( null == m ) {
|
||||||
return m;
|
return m;
|
||||||
|
@ -27,7 +27,7 @@ public class MemberService {
|
||||||
}
|
}
|
||||||
|
|
||||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
Boolean match = passwordEncoder.matches(member.getPw(), m.getPw());
|
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
||||||
if(!match) return null;
|
if(!match) return null;
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
|
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
|
||||||
import com.loafle.overflow.spring.AppConfig;
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import com.loafle.overflow.spring.MailConfiguration;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -17,7 +18,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||||
public class MemberDAOTest {
|
public class MemberDAOTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -41,7 +42,7 @@ public class MemberDAOTest {
|
||||||
Member member = new Member(1);
|
Member member = new Member(1);
|
||||||
member.setEmail("overflow@loafle.com");
|
member.setEmail("overflow@loafle.com");
|
||||||
|
|
||||||
Member rr = repo.findByEmail(member);
|
Member rr = repo.findByEmail("overflow@loafle.com");
|
||||||
System.out.println("rr.getCompanyName() = " + rr.getCompanyName());
|
System.out.println("rr.getCompanyName() = " + rr.getCompanyName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user