File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -106,12 +106,17 @@ const UnifiedLoginPage: React.FC = () => {
106106
107107 try {
108108 const cookies = await ssoLogin . current ! . login ( account , accountPassword , twoFactorCallback ) ;
109+ // 如果返回空字符串,说明用户取消了验证码输入
110+ if ( ! cookies ) {
111+ console . log ( '用户取消了SSO登录' ) ;
112+ return false ;
113+ }
109114 await AsyncStorage . setItem ( SSO_LOGIN_COOKIE_KEY , cookies ) ;
110115 await AsyncStorage . setItem ( SSO_LOGIN_USER_KEY , JSON . stringify ( { account : account , password : accountPassword } ) ) ;
111116 console . log ( '登录SSO成功:' , cookies ) ;
112117 return true ;
113118 } catch ( error : any ) {
114- // 这个 code 和 msg 是 SSO 提供的, 不是我们自己定义的
119+ // 这个 code 和 msg 是 SSO 提供的, 不是我们自己定义的
115120 const data = handleError ( error ) as { code : string ; msg : string } ;
116121 if ( data ) {
117122 Alert . alert ( '请求失败' , data . code + ': ' + data . msg ) ;
Original file line number Diff line number Diff line change @@ -207,10 +207,8 @@ class SSOLogin {
207207 // 调用回调获取用户输入的验证码
208208 const userInputCode = await twoFactorCallback . onSmsRequired ( phone , tip , sendSms ) ;
209209 if ( ! userInputCode ) {
210- throw {
211- type : RejectEnum . NativeLoginFailed ,
212- data : '用户取消了验证码输入' ,
213- } ;
210+ console . log ( '用户取消了验证码输入' ) ;
211+ return '' ; // 返回空字符串表示用户取消
214212 }
215213
216214 // 验证验证码
You can’t perform that action at this time.
0 commit comments