use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberListXmlController method getMemberListXml.
private MemberListXml getMemberListXml() {
List<MemberXml> memberListXml = new ArrayList<MemberXml>();
List<Member> memberList = memberListService.selectAll();
for (Member member : memberList) {
memberListXml.add(new MemberXml(member.getId(), member.getEmail(), member.getName(), member.getRegisterDate()));
}
return new MemberListXml(memberListXml);
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberLoginController method submit.
@RequestMapping(method = RequestMethod.POST)
public String submit(LoginRequest loginRequest, BindingResult bindingResult, HttpSession session, HttpServletResponse response, RedirectAttributes redirectAttributes) throws Exception {
if (bindingResult.hasErrors()) {
List<ObjectError> list = bindingResult.getAllErrors();
for (ObjectError e : list) {
logger.error("ObjectError : " + e);
}
throw new Exception("로그인 실패");
}
Member member = memberLoginService.login(loginRequest);
if (loginRequest.getSaveEmail() != null) {
// 이메일 저장시 쿠키 생성
Cookie cookie = new Cookie("SAVEEMAIL", member.getEmail());
cookie.setMaxAge(60 * 60);
response.addCookie(cookie);
} else {
// 이메일 저장 아닐시엔 쿠키 삭제
Cookie cookie = new Cookie("SAVEEMAIL", "");
cookie.setMaxAge(0);
response.addCookie(cookie);
}
session.setAttribute("MEMBER", member.getEmail());
// 확인용 로그 출력
logger.info(member.toString());
redirectAttributes.addFlashAttribute("SUCCESS_MSG", "로그인 성공");
return "redirect:/";
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberMyPageController method view.
@RequestMapping(value = "/member/mypage", method = RequestMethod.GET)
public String view(Model model, HttpSession session) {
String email = (String) session.getAttribute("MEMBER");
Member member = memberFindByEmailService.findByEmail(email);
model.addAttribute("loginInfo", member);
return "member/myPage";
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberFindByEmailService method findByEmail.
@Transactional
public Member findByEmail(String email) {
dao = sqlSessionTemplate.getMapper(MemberDao2.class);
Member member = dao.selectByEmail(email);
if (member == null) {
throw new MemberNotFoundException("회원 없음 : " + email);
}
return member;
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberDeleteService method delete.
@Transactional
public String delete(Long id) {
dao = sqlSessionTemplate.getMapper(MemberDao2.class);
Member member = dao.selectById(id);
if (member == null) {
throw new MemberNotFoundException("회원 없음 : " + id);
}
dao.deleteMember(id);
return member.getPhoto();
}
Aggregations