private static bool IsUserDataValid(UserDataFetcher UDF, out string lastUser) { lastUser = UserDataFetcher.GetLastUsedUsername(); //first validate it, because user is scum if (!InputValidator.ValidateUsername(lastUser)) { return(error.SetErrorAndReturnFalse(ErrorCode.INVALID_USERNAME)); //#throw new exception, session file corrupted } //get id. it might be email or username UDF.GetIdByUsernameOrEmail(lastUser, saveId: true); if (!InputValidator.ValidateId(UDF.GetId())) { return(error.SetErrorAndReturnFalse(ErrorCode.USER_NOT_FOUND)); } return(true); }
private void Method() { //try //{ if (Auth.LogInUsingSession(new ProgressBar())) { ShowAfterLoginScreen(); } else { MessageBox.Show(Auth.error.Message() + " " + Auth.messageToOutterWorld + $"({Auth.messageToOutterWorld.Length})"); } textUsername.Text = UserDataFetcher.GetLastUsedUsername(); //} //catch //{ //throw; //} }
private void LoginForm_Load(object sender, EventArgs e) { //Method(); this.textUsername.Text = UserDataFetcher.GetLastUsedUsername(); }