Code Monkey home page Code Monkey logo

Comments (3)

zhanghaihua avatar zhanghaihua commented on July 17, 2024

var accountName = accountNameInput.value;
var pwd = accountPwdInput.value;
var argstr = 'v_code=' +vcodeinput.value;

sumeru.auth.tpa.login(accountName, pwd, argstr, function(response){
if (response.success) {
//good
}
else {
var authData = sumeru.auth.getModel().getData();
if(authData.info && authData.info.v_url){
//need vcode
var img = rootBlock.querySelector('#vcodeimg');
img.src = 'http://vcode.im.baidu.com/cgi-bin/genimg/?' + authData.info.v_url;
img.onload = function(){
rootBlock.querySelector('#vcodeLabel').style.display = "block";
};
enable_vcode = true;
}
}
}

view template sample:

验证码:
状态: 在线 忙碌 离开 隐身
    <div id="loginButtonCenter">
        <input type="submit" value="登录" id="loginButton" class="button primary" />
    </div>
</form>

from cloudajs.

shanewei avatar shanewei commented on July 17, 2024

Thank you for you reply my question . I will have a try.

from cloudajs.

tongyao avatar tongyao commented on July 17, 2024

We've removed auth.baidu.login for some internal security reasons in recent versions, but not yet from the API docs.
If you can't get it working right know, you may wait for an update from us with Baidu OAuth, or go to grab an baidu sdk and do it yourself.

from cloudajs.

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.