From ba434da70764f3f4f4ad8c04135772c0aa096c77 Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Wed, 24 Dec 2025 13:45:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=88=E6=9D=83=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/oauth/index.js | 13 ++++++++++--- src/components/oauth/index.ts | 13 +++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/es/components/oauth/index.js b/es/components/oauth/index.js index 98c986732..00fc1d68a 100644 --- a/es/components/oauth/index.js +++ b/es/components/oauth/index.js @@ -1,4 +1,3 @@ -import assert from "assert"; export default OakComponent({ // Virtual Component isList: false, @@ -25,8 +24,16 @@ export default OakComponent({ this.setState({ loading: false }); return; } - assert(state, 'State parameter is missing'); - assert(code, 'Code parameter is missing'); + if (!code) { + this.setErrorMsg('Missing authorization code'); + this.setState({ loading: false }); + return; + } + if (!state) { + this.setErrorMsg('Missing state parameter'); + this.setState({ loading: false }); + return; + } this.setState({ hasError: false, errorMessage: '' }); if (!state) { this.setErrorMsg('Invalid state parameter'); diff --git a/src/components/oauth/index.ts b/src/components/oauth/index.ts index 92039ca47..aef6742c1 100644 --- a/src/components/oauth/index.ts +++ b/src/components/oauth/index.ts @@ -32,8 +32,17 @@ export default OakComponent({ return; } - assert(state, 'State parameter is missing'); - assert(code, 'Code parameter is missing'); + if (!code) { + this.setErrorMsg('Missing authorization code'); + this.setState({ loading: false }); + return; + } + + if (!state) { + this.setErrorMsg('Missing state parameter'); + this.setState({ loading: false }); + return; + } this.setState({ hasError: false, errorMessage: '' });