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

GetPassword is broken #392

Closed
ZacharyPatten opened this issue Sep 11, 2020 · 9 comments
Closed

GetPassword is broken #392

ZacharyPatten opened this issue Sep 11, 2020 · 9 comments
Labels
bug closed-stale This issue is closed because it went stale and there was no action planned. It can be reopened. good first issue This seems like a good issue if you're a new contributor. help wanted We would be willing to take a well-written PR to help fix this. stale

Comments

@ZacharyPatten
Copy link

ZacharyPatten commented Sep 11, 2020

GetPassword is broken

  1. Writing "\b \b" will not move up lines in the console, so if the input currently spans multiple lines your backspace breaks (will not back space to previous lines in the console).
  2. It doesn't support Delete, Left/Right Arrow, Home, or End. Or the CTRL modifier.
  3. When pressing keys such as those mentioned in 2. and keys like F1 through F12 it is adding '\0' chars to the resulting string.
  4. The display character should be an optional parameter so the user can choose alternatives to the hard coded '*' character.
  5. Why have ConsoleColor parameters or a prompt on the method? Let other code handle that.
  6. The SecureString is obsolete in .NET Core, so you should probably not include that in packages that target frameworks other than .NET Framework.

Example fixes

I have written my own version of this method that fixes topics1.-5. from above:
Source Code
Example Code

Also, I mentioned that topic 5. from above should be handled by other means than optional parameters on every relevant method; here is an example of a better approach in my opinion:
Source Code
There are example usages in the same file as the source code.

@natemcmaster natemcmaster added help wanted We would be willing to take a well-written PR to help fix this. good first issue This seems like a good issue if you're a new contributor. labels Nov 7, 2020
@natemcmaster
Copy link
Owner

It seems you know what needs to be fixed. Would you mind raising a pull request?

@natemcmaster
Copy link
Owner

Re:

The SecureString is obsolete in .NET Core, so you should probably not include that in packages that target frameworks other than .NET Framework.

I'd rather keep the API until .NET actually deprecates. I know there has been discussion about doing so, but as of .NET 5 this API is still not officially marked as [Obsolete].

@ZacharyPatten
Copy link
Author

Sorry for the late response, yes I do know the fix (the example I linked fixes it). But it is a different approach and I would recommend someone test both approaches to see if there are any negatives of my approach in comparison. Although my version fixes this issue, I'm not sure if it introduces any other issues.

@github-actions
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

@github-actions github-actions bot added the stale label Jun 13, 2022
@github-actions
Copy link

Closing due to inactivity.
If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.

@github-actions github-actions bot added the closed-stale This issue is closed because it went stale and there was no action planned. It can be reopened. label Jun 27, 2022
@ZacharyPatten
Copy link
Author

I noticed that a bot closed this, but this is still an open/active issue.

I don't use your library so I haven't been motivated to open a pull request, but all the info on how to fix it was provided for someone willing.

@natemcmaster
Copy link
Owner

My stance on this is here #485. I can reopen the issue, but the bot will just close again in a year if no one comes forward to implement a fix.

@natemcmaster natemcmaster reopened this Jun 29, 2022
@natemcmaster natemcmaster removed closed-stale This issue is closed because it went stale and there was no action planned. It can be reopened. stale labels Jun 29, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

@github-actions github-actions bot added the stale label Jun 29, 2023
@github-actions
Copy link

Closing due to inactivity.
If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.

@github-actions github-actions bot added the closed-stale This issue is closed because it went stale and there was no action planned. It can be reopened. label Jul 13, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug closed-stale This issue is closed because it went stale and there was no action planned. It can be reopened. good first issue This seems like a good issue if you're a new contributor. help wanted We would be willing to take a well-written PR to help fix this. stale
Projects
None yet
Development

No branches or pull requests

2 participants