Giter Site home page Giter Site logo

Comments (4)

GangZhuo avatar GangZhuo commented on June 16, 2024

Cannot repeat.

from baidupcs.

apsun avatar apsun commented on June 16, 2024

I think err_no=18 corresponds to this screen:

screenshot from 2015-10-08 08 45 04

If that is the case, then we can treat it as no error occurred. I will look through the JS to figure out how the error codes are mapped later.

from baidupcs.

apsun avatar apsun commented on June 16, 2024

Here's the error code map:

lang.errMsg.login = {
'-1': {
msg: '系统错误,请您稍后再试,<a href="http://passport.baidu.com/v2/?ucenterfeedback#{urldata}#login"  target="_blank">问题反馈</a>',
field: ''
},
'1': {
msg: '您输入的帐号格式不正确',
field: 'userName'
},
'2': {
msg: '您输入的帐号不存在,可<a href=\'http://passport.baidu.com/v2/?ucenterfeedback#{urldata}#login_7\' target=\'_blank\'>查看帮助</a>或<a href=\'http://passport.baidu.com/v2/?reg#{urldata}\' target=\'_blank\'>立即注册</a>',
field: 'userName'
},
'3': {
msg: '验证码不存在或已过期,请重新输入',
field: ''
},
'4': {
msg: '您输入的帐号或密码有误,<a href="http://passport.baidu.com/?getpassindex#{urldata}"  target="_blank" >忘记密码</a>?',
field: 'password'
},
'5': {
msg: '请在弹出的窗口操作,或重新登录',
field: ''
},
'6': {
msg: '您输入的验证码有误',
field: 'verifyCode'
},
'7': {
msg: '密码错误,可以试试<a onclick="var smDom=document.getElementsByClassName(\'pass-sms-btn\');if(smDom.length>0){smDom[0].click();}" >短信登录\r\n</a>,或者<a href="http://passport.baidu.com/?getpassindex#{urldata}"  target="_blank" >找回密码</a>',
field: 'password'
},
'16': {
msg: '您的帐号因安全问题已被限制登录,<a href="http://passport.baidu.com/v2/?ucenterfeedback#{urldata}#login"  target="_blank" >问题反馈</a>',
field: ''
},
'257': {
msg: '请输入验证码',
field: 'verifyCode'
},
'100027': {
msg: '百度正在进行系统升级,暂时不能提供服务,敬请谅解',
field: ''
},
'120016': {
msg: '',
field: ''
},
'18': {
msg: '',
field: ''
},
'400031': {
msg: '请在弹出的窗口操作,或重新登录',
field: ''
},
'400032': {
msg: '',
field: ''
},
'400034': {
msg: '',
field: ''
},
'401007': {
msg: '您的手机号关联了其他帐号,请选择登录',
field: ''
},
'120021': {
msg: '登录失败,请在弹出的窗口操作,或重新登录',
field: ''
},
'500010': {
msg: '登录过于频繁,请24小时后再试',
field: ''
},
'200010': {
msg: '验证码不存在或已过期',
field: ''
},
'100005': {
msg: '系统错误,请您稍后再试',
field: ''
},
'120019': {
msg: '请在弹出的窗口操作,或重新登录',
field: 'userName'
},
'110024': {
msg: '此帐号暂未激活,<a href="#{gotourl}" >重发验证邮件</a>',
field: ''
},
'100023': {
msg: '开启Cookie之后才能登录,<a href="http://passport.baidu.com/v2/?ucenterfeedback#{urldata}#login"  target="_blank" >如何开启</a>?',
field: ''
},
'17': {
msg: '您的帐号已锁定,请<a href=\'http://passport.baidu.com/v2/?ucenterfeedback#login_10\' target=\'_blank\'>解锁</a>后登录',
field: 'userName'
},
'400401': {
msg: '',
field: ''
},
'400037': {
msg: '',
field: ''
}
};

So I think we should only be attempting the captcha when err_no is 3, 6, 257, or 200010.

This is the current code in pcs.c:

if (error == 0) {
        if (pcs_islogin(pcs) == PCS_LOGIN) {
            // ...
            return PCS_OK;
        }
        else {
            // ...
            return PCS_FAIL;
        }
}
else if (error == 4) {
        // Handle invalid password...
}
else {
        if (code_string) pcs_free(code_string);
        code_string = pcs_get_embed_query_token_by_key(html, "&codestring");
        // Handle captcha...
}

I have not tested this yet (for some reason I don't get captchas), but something like this should fix the problem:

if (error == 4) {
        // Handle invalid password...
}
else if (error == 3 || error == 6 || error == 257 || error == 200010) {
        if (code_string) pcs_free(code_string);
        code_string = pcs_get_embed_query_token_by_key(html, "&codestring");
        // Handle captcha...
}
else {
        if (pcs_islogin(pcs) == PCS_LOGIN) {
            // ...
            return PCS_OK;
        }
        else {
            // ...
            return PCS_FAIL;
        }       
}

from baidupcs.

GangZhuo avatar GangZhuo commented on June 16, 2024

Thanks. Fixed via 4510dfd

from baidupcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.