use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberFindByIdService method findById.
@Transactional
public Member findById(Long id) {
dao = sqlSessionTemplate.getMapper(MemberDao2.class);
Member member = dao.selectById(id);
if (member == null) {
throw new MemberNotFoundException("회원 없음 : " + id);
}
return member;
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberLoginService method login.
@Transactional
public Member login(LoginRequest req) {
dao = sqlSessionTemplate.getMapper(MemberDao2.class);
Member member = dao.selectByEmail(req.getEmail());
if (member == null) {
throw new MemberNotFoundException("회원 없음 : " + req.getEmail());
}
if (!member.checkPassword(req.getPassword())) {
throw new IdPasswordNotMatchingException("비밀번호 다름");
}
return member;
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberRegisterController method submit.
@RequestMapping(method = RequestMethod.POST)
public String submit(RegisterRequest registerRequest, BindingResult bindingResult, RedirectAttributes redirectAttributes, HttpServletRequest request) throws Exception {
if (bindingResult.hasErrors()) {
List<ObjectError> list = bindingResult.getAllErrors();
for (ObjectError e : list) {
logger.error("ObjectError : " + e);
}
throw new Exception("회원가입 실패");
}
// 업로드 폴더 시스템 물리적 경로 찾기
String uploadURI = "/uploadfile/memberphoto";
String dir = request.getSession().getServletContext().getRealPath(uploadURI);
// 업로드 파일의 물리적 저장
if (!registerRequest.getPhotofile().isEmpty()) {
registerRequest.getPhotofile().transferTo(new File(dir, registerRequest.getEmail()));
registerRequest.setPhoto(registerRequest.getEmail());
}
Member member = memberRegisterService.register(registerRequest);
// 가입 축하 메일 전송
mailHelper.sendMail(member);
redirectAttributes.addFlashAttribute("SUCCESS_MSG", "회원가입 성공");
return "redirect:/member/login";
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberMyPageController method viewById.
// @PathVariable : 경로의 특정 위치 값이 고정되지 않고 달라질 때 사용하는 것
@RequestMapping(value = "/member/mypage/{id}", method = RequestMethod.GET)
public String viewById(@PathVariable("id") Long memId, Model model) {
Member member = memberFindByIdService.findById(memId);
model.addAttribute("loginInfo", member);
return "member/myPage";
}
use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.
the class MemberRegisterService method register.
@Transactional
public Member register(RegisterRequest req) {
dao = sqlSessionTemplate.getMapper(MemberDao2.class);
Member member = dao.selectByEmail(req.getEmail());
if (member != null) {
throw new AlreadyExistingMemberException("이메일 중복 : " + req.getEmail());
}
member = req.toMember();
dao.insertMember(member);
return member;
}
Aggregations