Hello.

I want to make a loguin function, that checks users against a XMPP server. 
So far I am doing something similar with IMAP and emails.
And I want to change loguin against XMPP.  

Here is my function, with Imap. Can you helpm me with xmpp ? Thanks!


**
* Loguin function with IMAP, if there is a user with that email, call 
succesCB, if not, failCB.
* @method checkPassword
* @param name {string} Email id
* @param server {string} Email server
* @param password {string} Password
* @param successCB {function} If loguin was successful, call successCB(name)
* @param errorCB {function} If loguin was not  successful, call failCB(name)
*/

function checkPassword(userName, server, password, successCB, failCB) {


    var uName = userName + "@" + server;
    var hostName;
    var portNumber;
    var tlsEnable;
    
       var imap = new Imap({
      user: uName,
      password: password,
      host: hostName,
      port: portNumber,
      tls: tlsEnable,
      tlsOptions: { rejectUnauthorized: false }
    });

    function openInbox(cb) {
      imap.openBox('INBOX', true, cb);
    }

    imap.once('ready', function() {
        console.log(uName + "Authenticated");
        successCB(uName);
        imap.end();
    });

    imap.once('error', function(err) {
        console.log(uName + "Not authenticated");
        failCB("Wrong Login, try again",1);
    });

    imap.once('end', function() {
        console.log('Closing IMAP.');
    });

    imap.connect();
    
}


Thanks!!

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/832b913b-bc36-4f98-99ab-e54aebae6933%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to