Skip to content

Commit d887fba

Browse files
committed
onBeforeOtp 추가
1 parent 7f428f3 commit d887fba

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

auth.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ export async function login(
111111
username: string,
112112
password: string,
113113
getOtp: () => Promise<string>,
114+
onBeforeOtp: () => Promise<void> = async () => { },
114115
): Promise<string> {
115116
await cookieJar.removeAllCookies();
116117

117118
await loginUsingPassword(username, password);
118119
await secondFactorPage();
120+
await onBeforeOtp();
119121
await selectEmailOtp();
120122
const otp = await getOtp();
121123
await submitOtp(otp);
@@ -129,14 +131,15 @@ export async function loginWithRetry(
129131
username: string,
130132
password: string,
131133
getOtp: () => Promise<string>,
134+
onBeforeOtp: () => Promise<void> = async () => { },
132135
): ReturnType<typeof login> {
133136
const backoffSeconds = [15, 30, 30, 60, 60];
134137
const getJitter = () => Math.random() * 15;
135138

136139
for (; ;) {
137140
try {
138141
// eslint-disable-next-line no-await-in-loop
139-
return await login(username, password, getOtp);
142+
return await login(username, password, getOtp, onBeforeOtp);
140143
} catch (e) {
141144
if (backoffSeconds.length === 0) {
142145
throw e;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kaist-today-notice",
3-
"version": "8.0.1",
3+
"version": "8.1.0",
44
"description": "KAIST 오늘의 공지사항",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)