微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

strophe连接有什么办法禁止查看明文密码吗?

如何解决strophe连接有什么办法禁止查看明文密码吗?

Is there any way for strophe connection to prohibit viewing plaintext passwords?

我使用下面的方法strophe连接到XMPP服务器,但是当我使用console.log(connection)时,我可以看到登录的明文密码。您还可以在调试断点处看到明文密码。

var BOSH_SERVICE = 'http://127.0.0.1:7070/http-bind/';
var connection = null;
var connected = false;
var jid = "";
function onConnect(status) {
    console.log(status)
    if (status == Strophe.Status.CONNFAIL) {
        alert("fail!");
    } else if (status == Strophe.Status.AUTHFAIL) {
        alert("fail!");
    } else if (status == Strophe.Status.disCONNECTED) {
        alert("fail!");
        connected = false;
    } else if (status == Strophe.Status.CONNECTED) {
        alert("success!");
        connected = true;
        
        connection.addHandler(onMessage,null,'message',null);
 
        connection.send($pres().tree());
    }
    // this connection can see the plaintext password;
    console.log(connection);
    
}
...

$(document).ready(function() {

    $('#btn-login').click(function() {
        if(!connected) {
            connection = new Strophe.Connection(BOSH_SERVICE);
            connection.connect($("#input-jid").val(),$("#input-pwd").val(),onConnect);
            jid = $("#input-jid").val();
        }
    });
    ...
});

断点调试图片如下:

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。