protected override string OnProcess(string message) { string retval; var user = PlayerRepositoryExtensions.Authenticate(this.ConnectionObject.User, message); if (user != null) { this.ConnectionObject.CreateFileSystem(); retval = this.GetMessage(220, "Password ok, FTP server ready"); } else { retval = this.GetMessage(530, "Username or password incorrect"); } ////if (this.ConnectionObject.Login(sMessage)) ////{ //// return this.GetMessage(220, "Password ok, FTP server ready"); ////} //// ////return this.GetMessage(530, "Username or password incorrect"); return(retval); }
/// <summary>ProcessInput is used to receive the user input during this state.</summary> /// <param name="command">The command text to be processed.</param> public override void ProcessInput(string command) { if (ValidateUserName(ref command)) { // The name is valid, but has it been taken already? if (PlayerRepositoryExtensions.UserNameExists(command)) { Session.Write(new OutputBuilder().AppendLine("I'm sorry, that name is already taken. Please choose another.")); } else if (StateMachine != null) { Session.User.UserName = command; if (AppConfigInfo.Instance.UserAccountIsPlayerCharacter) { Session.Thing.Name = command; } else { throw new NotImplementedException("Need to ensure correct flow into character selection state."); } StateMachine.HandleNextStep(this, StepStatus.Success); } } }
/// <summary>Authenticate the user name and password supplied.</summary> /// <returns>True if authenticated, else false.</returns> private User Authenticate(string password) { return(PlayerRepositoryExtensions.Authenticate(userName, password)); }