Skip to content

Commit 336f426

Browse files
author
lucifer
committed
fix: login
1 parent d631e39 commit 336f426

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

middleware/passport.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ module.exports = async function checkAuth(ctx, next) {
4444
if (!code) {
4545
ctx.body = fail({ message: "请先登录~", code: 91 });
4646
return;
47+
} else if (code.length !== 20) {
48+
ctx.body = fail({ message: "code 码无效,请重新登录", code: 92 });
49+
return;
4750
}
4851
const { access_token } = await fetch(
4952
`https://github.com/login/oauth/access_token?code=${code}&client_id=${clientId}&client_secret=${secret}`,

0 commit comments

Comments
 (0)