Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username With \ not work #34

Open
andrebassi opened this issue Aug 31, 2017 · 1 comment
Open

Username With \ not work #34

andrebassi opened this issue Aug 31, 2017 · 1 comment
Labels

Comments

@andrebassi
Copy link

I try this username Azure format: appservice\username and return me:


handle.data.waiting: false 331
....................

331 Password required

331

@sparkida sparkida added the bug label Jan 11, 2018
@sparkida
Copy link
Owner

sparkida commented Feb 7, 2018

Thanks for reporting the issue, Azure has a free tier, if I have time I will try to add support. Can you try this and share your results? You'll need to update the configuration object.

/** Add your config **/
var config = {
  host: 'localhost',
  port: 21,
  user: 'root',
  pass: '',
  debug: true
};
const FTP = require('ftpimp');
const ftp = FTP.create(config, false);
//add the code to handle requesting a password
ftp.cmd.codes[331] = 'sendPass';
//change login to only send user
ftp.cmd.login = ftp.user(ftp.config.user, (err, data) => {
  if (err) {
    return console.log(err);
  }
  console.log('user sent');
});
//attach sendPass so that when 331 comes in, this method is triggered
ftp.cmd.sendPass = function () {
  console.log('sending pass');
  ftp.pass(ftp.config.pass, function (err, data) {
    if (err) {
      return console.log(err);
    }
    console.log('password sent');
    ftp.raw('CWD', function (res) {
      var dir = res.indexOf('/');
      dir = res.slice(dir - 1).trim();
      ftp.cwd = ftp.baseDir = dir;
      console.log('current dir: ' + ftp.cwd);
      ftp.emit('ready');
      ftp.isReady = true;
    });
  });
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants