conn.autericate는 strophe.register.js를 사용하여 새 등록 중에 정의되지 않습니다

StackOverflow https://stackoverflow.com//questions/25056695

  •  21-12-2019
  •  | 
  •  

문제

안녕하세요, 등록을위한 단계를 수행하여 Strrophe.js 및 strophe.register.js 플러그인을 사용하여 Local OpenFire 서버에 새 계정을 등록하려고 시도하고 있습니다. 이거는 내 strophe.register.js에 오류가 발생합니다. var auth_old= conn.authenticate.bind (conn); conn.authenticate가 정의되지 않은 경우 아래의 코드는 다음과 같습니다 내 JS 파일의 코드

$(document).ready(function () {              
var conn = new Strophe.Connection(
    "http://jabber.local/http-bind");
console.log(conn);
var callback = function (status) {

    if ( status === Strophe.Status.REGISTERING ) {
        console.log('REGISTERING')
    conn.authenticate();
    }

    else if ( status === Strophe.Status.REGIFAIL ) {
        console.log('REGIFAIL')
    }

    else if ( status === Strophe.Status.REGISTER ) {
        console.log('REGISTER')
        conn.register.fields.username = "joe"
                conn.register.fields.password = "doe"
                conn.register.submit();
    }

    else if ( status === Strophe.Status.SUBMITTING ) {
        console.log('SUBMITTING')
    }

    else if ( status === Strophe.Status.SBMTFAIL ) {
        console.log('SBMTFAIL')
        console.log('Something went wrong...');
    }

    else if ( status === Strophe.Status.REGISTERED ) {
        console.log('REGISTERED')

        console.log('Your account has been created successfully and is ready to use!');

    }

}   

conn.register.connect("example.com", callback);

});
.

및 HTML 파일 코드는

입니다.
<html>
<head>

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js'></script>
<script src='../scripts/strophe.js'></script>
<script type="text/javascript" src="../scripts/strophe.register.js"></script>
<script src='../scripts/flXHR.js'></script>
<script src='../scripts/strophe.flxhr.js'></script>

<link rel='stylesheet' href='hello.css'>
<script src='hello.js'></script>
</head>
<body>
<h1>Hello</h1>

<div id='log'>
</div>

<!-- login dialog -->
<div id='login_dialog' class='hidden'>
  <label>JID:</label><input type='text' id='jid'>
  <label>Password:</label><input type='password' id='password'>
</div>
</body>
</html>
.

enyone은 왜 이것이 왜 일어 났는지와 이것을 해결하는 방법을 알려줄 수 있습니다.

/* if (register.length === 0) {
        conn._changeConnectStatus(Strophe.Status.REGIFAIL, null);
        return true;
    }*/
this.enabled = true;
.

도움이 되었습니까?

해결책

이전 버전의 플러그인을 사용하고 있음을 알아 차렸다.strophe.register.js에서 https : //github.com/metajack/strophejs-plugins/blob/master/register/strophe.register.js

라인 아래가없는 최신 버전을 확인했습니다.

var auth_old = conn.authenticate.bind(conn);
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top