아이디도 찾았으니
비밀번호도 재설정해보자
두 가지 방법이 있다
문자인증->재설정
이메일 인증->재설정
문자인증은 구현해놨으니
이메일 인증만 다루도록 해보자!
역시 이전에 구현한 적이 있다
https://cordingmonster.tistory.com/40?category=1034325
Spring boot 비밀번호찾기!(1) 인증번호 발송
시스템은 이메일을 입력하면 db에 존재하는 이메일인지 확인하고 인증번호 요청을 누르면 인증번호가 가고 인증번호를 알맞게 제출하면 임시 비밀번호를 주고 db 비밀번호도 임시로 바뀌게 된
cordingmonster.tistory.com
Dao

역시 내역이 존재한다면
update 하기 위해 쿼리문을 작성해준다
사실상 문자인증했을 때랑 똑같다고 보면 된다
Service

인증 요청 내역이 있나
확인하기 위해
찾아오는 함수를 작성한다

휴대폰 인증과 비슷하지만
이메일 인증은 횟수 제한을
해놓지 않아서 좀 더 심플하다
회원이 존재하는지 검사
userDto userDto=userService.findEmail(email);
if(userDto!=null)
인증번호 생성
String tempNum=utillService.GetRandomNum(tempNumLength);
첫 요청인지 db검사
confrimDto confrimDto=findConfrimEmai(email);
if(confrimDto==null)
db수정
insertConfrim(null, email,tempNum,null);
updateconfrimEmail(confrimDto, tempNum);
이메일 전송
sendEmailService.sendEmail(email,"안녕하세요 kim's Shop입니다","인증번호는 "+tempNum+" 입니다.");
테스트
첫 비밀번호 찾기 시도
(실제 메일이라 가려야 한다)




두 번째 시도



역시 이제 검증을 하러 가자!
'Spring boot kim's Shop > 로그인' 카테고리의 다른 글
Springboot Jwt+로그아웃! with 쿠키 지워주기 (0) | 2021.08.04 |
---|---|
Springboot Jwt+로그인!(2) with 로그인 완료 (0) | 2021.08.03 |
Springboot Jwt+비밀번호찾기!(2) with email (0) | 2021.08.01 |
Springboot Jwt+아이디 찾기! (0) | 2021.07.28 |
Springboot Jwt+로그인!(1) with successfulAuthentication/unsuccessfulAuthentication (0) | 2021.07.27 |