Files
ftp-server/src/commands/user.js
Tyler Stewart 1009970bb9 feat: initial commit
HEAD
2017-03-06 15:07:02 -07:00

16 lines
450 B
JavaScript

module.exports = function ({log, command} = {}) {
if (this.username) return this.reply(530, 'Username already set');
this.username = command._[1];
if (this.server.options.anonymous === true) {
return this.login(this.username, '@anonymous')
.then(() => {
return this.reply(230);
})
.catch(err => {
log.error(err);
return this.reply(530, err || 'Authentication failed');
});
}
return this.reply(331);
};