UNPKG

ftpd.js

Version:
79 lines (72 loc) 1.98 kB
/** * * @access public * @constructor * @param {Interface} theInterface the interface the user connected through * @param {net.Socket} socket the socket the user is attached to * @since 0.6.0 */ function User( theInterface, socket ) { this.theInterface = theInterface; this.socket = socket; } /** * * This function is used to get the username of the user. * Please note that the username may not have been set when you request it as it's defined when the * user executes the "USER <username>" command * * @access public * @returns {string} the username of the user if it's been defined * @since 0.6.0 */ User.prototype.getUsername = function () { return this.username; }; User.prototype.setUsername = function ( username, local ) { local = local || true; //Check if we should only change the username stored in the memory if ( local ) { this.username = username; return; } }; User.prototype.getPassword = function () { return this.password; }; /** * * This function is used to get the password of the user. * Please note that the password may not have been set when you request it as it's defined when the * user executes the "PASS <username>" command * * @access public * @returns {string} the password of the user if it's been defined * @since 0.6.0 */ User.prototype.setPassword = function ( password, local ) { local = local || true; //Check if we should only change the password stored in the memory if ( local ) { this.password = password; return; } }; /** * * @returns {Interface} the interface the user connected through */ User.prototype.getInterface = function () { return this.theInterface; }; /** * * This function is used to get the socket the user is attached to * * @access public * @returns {net.Socket} the socket the user is attached to */ User.prototype.getSocket = function () { return this.socket; }; module.exports = User;