automatic password renewal skip logic added

This commit is contained in:
hojin.jeong 2025-12-23 12:21:03 +09:00
parent 90cbc95ee2
commit 9c5b413d84
2 changed files with 29 additions and 1 deletions

View File

@ -6,6 +6,7 @@ class Constants {
static SYSTEM_CHECK_URL = `${Constants.BASE_URL}/index_check.html` static SYSTEM_CHECK_URL = `${Constants.BASE_URL}/index_check.html`
static MAIN_PAGE_URL = `${Constants.BASE_URL}/common.do?method=main` static MAIN_PAGE_URL = `${Constants.BASE_URL}/common.do?method=main`
static LOGIN_REQUEST_URL = `${Constants.BASE_URL}/userSsl.do?method=login` static LOGIN_REQUEST_URL = `${Constants.BASE_URL}/userSsl.do?method=login`
static PW_CHANGE_NEXT_URL = `${Constants.BASE_URL}/userSsl.do?method=pspnPwChng`
static BUY_PAGE_URL = `${Constants.API_URL}/olotto/game/game645.do` static BUY_PAGE_URL = `${Constants.API_URL}/olotto/game/game645.do`
static BUY_LOTTO_645_URL = `${Constants.API_URL}/olotto/game/execBuy.do` static BUY_LOTTO_645_URL = `${Constants.API_URL}/olotto/game/execBuy.do`
static BUY_READY_SOCKET_URL = `${Constants.API_URL}/olotto/game/egovUserReadySocket.json` static BUY_READY_SOCKET_URL = `${Constants.API_URL}/olotto/game/egovUserReadySocket.json`

View File

@ -62,7 +62,34 @@ class Lotto {
if(loginResult instanceof Error) if(loginResult instanceof Error)
return loginResult return loginResult
const $ = Cheerio.load(loginResult.data) let $ = Cheerio.load(loginResult.data)
/**
* 비밀번호 변경 감지
*
* 비밀번호가 변경이 경우 'https://www.dhlottery.co.kr/userSsl.do?method=pwdPlyChngNoti' redirect
* 비밀번호를 유지할 변경할 고르는 페이지인데, 여기에 있는 chngTgtId pwdChgToken를 추출해서
*
* POST 'https://www.dhlottery.co.kr/userSsl.do?method=pspnPwChng'
* payload로 chngTgtId, pwdChgToken을 보내면 다음에 하기 처리됨.
*
* 성공하면 'https://www.dhlottery.co.kr/user.do?method=login&returnUrl=https%3A%2F%2Fwww.dhlottery.co.kr%2Fcommon.do%3Fmethod%3Dmain'
* redirect 진행되며, 마지막으로 MAIN_PAGE_URL로 redirect됨
*/
const targetInput = $('#chngTgtId')
if(targetInput.length !== 0) {
const chngTgtId = targetInput.val()
const pwdChgToken = $('#pwdChgToken').val()
const pwChgNextData = { chngTgtId, pwdChgToken }
const pgChgNextResult = await this.#_request('POST', Constants.PW_CHANGE_NEXT_URL, pwChgNextData)
if(pgChgNextResult instanceof Error)
return pgChgNextResult
$ = Cheerio.load(pgChgNextResult.data)
}
const btnCommonElements = $('a.btn_common') const btnCommonElements = $('a.btn_common')
if(btnCommonElements.length > 0) if(btnCommonElements.length > 0)
return new Error('로그인에 실패했습니다. 아이디 또는 비밀번호를 확인해주세요.') return new Error('로그인에 실패했습니다. 아이디 또는 비밀번호를 확인해주세요.')