-
Notifications
You must be signed in to change notification settings - Fork 58
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
Added visual feedback while hiding secret information #22
Added visual feedback while hiding secret information #22
Conversation
Are you sure you want to output the exact number of spaces as characters are input in this mode? There are many examples of password input dialogs that output 1-3 |
IMHO this solution with cursor representation works well enough as visual feedback by cursor. Thanks for your time @troglobit ! A bit later when I will exactly know if BitShares |
@cogutvalera I have no opinion really, it was just an observation. You guys are the only users of this API atm, so you're free to define the initial implementation. I can merge the PR as-is, but let's await a reply from @pmconrad |
@troglobit Thank you very much ! Really appreciate your time and efforts ! Just wanted to know what do you think about current solution with visual feedback by cursor :) |
IMO the behaviour is still strange and unexpected. Simple usage is as expected, but if you move the cursor back and forth you can "erase" the visible part of the input line as well. I. e. you make it invisible although it's there. You can also move the cursor back into the regexp-matching part and change it, so that it no longer matches. This will make the entire line visible again (which is OK), but if you change it back so that it matches, the stuff that should be invisible is still there. Until you move the cursor over it again, which will overwrite it with blanks. |
Thank you very much @pmconrad ! I will check it and improve soon. |
@pmconrad sorry I cannot understand just this, what do you mean here ? Thanks ! |
|
Thanks @pmconrad this I've understood ! I cannot understand what did you mean by:
If I move cursor back and forth nothing heppens, that's why I could NOT understand only this 1 point. Thanks ! Now I understood what did you mean ! |
I've looked into this now and I agree with @pmconrad, this is messy and I'm not sure the current implementation can be improved. So I'm leaning towards reverting it from editline. @cogutvalera Have you looked into implementing something else for 'unlock' using the existing
|
Thank you very much for your idea ! I'm too thinking about another solution and have also some other ideas based on current merged code. Please do not revert it now, a bit later let's decide ... hope soon to finish with my solution or maybe with yours ... let's see soon ... Thanks ! |
OK, I'll hold off on the revert for now. |
Thanks a lot ! I'm working on it and hope soon to finish ... |
new commit is ready, check it please, added |
@cogutvalera This is quite an extensive change. Would you care to describe what it does and how this improves the usability of editline more than "new commit, please check"? For one, the commit no longer seems to match the original PR description, at all. Also, the |
@troglobit Thanks ! I've described code by comments in new commit, also now using |
@troglobit is it better now ? do you have still any questions or miss-understandings maybe ? |
87f262b
to
1805c23
Compare
No it's not. Maybe I wasn't clear, but I didn't want you to put a C++ comment on every line of this C project (no other part of the code uses C++ comments and I'd rather not spend more time cleaning up obvious coding style offenses). I simply wanted you to describe, in plain English, what your commits aims to achieve. I can read the code, I'm familiar with C, so commenting obvious code lines is not of interest to me. What I am, and every other maintainer of an Open Source project is, interested in is what you want. There may be other ways to achieve what you want, there may be misunderstandings. Things that are easily explained by talking about it. Also, I questioned your reuse of this pull request, which initially was about moving the cursor on secret data, we've clearly moved beyond that by now, so maybe it's time to close this PR and restart afresh -- I'd really not like to pollute the commit history of this project with your experimental ideas. Please finish them and clean them up to easily reviewable changes s on your own end before submitting a new PR. |
ok sure I can rewrite commit history in this PR so it would be clean and easily reviewable changes or do you wish new PR only without rewriting and clean commit history here ? |
1805c23
to
114a03f
Compare
I've rewrited commit history so now it is clean and without comments. The main idea of this PR is to add visual feedback for hiding secret information by entering security mode as you suggested earlier:
|
IMHO it is pretty simple idea enough and very effective at the same time, works nice for me |
This last commit sure is better, codewise, no doubt. However, I'm not convinced any of it belongs as part of the editline library. So I'm leaning towards declining this PR, and also revert the previous code, please follow my reasoning below for an explanation:
Here is a modified version of int main(void)
{
char *line;
char *prompt = "cli> ";
char *passwd = "Enter password: ";
/* Setup callbacks */
rl_set_complete_func(&my_rl_complete);
rl_set_list_possib_func(&my_rl_list_possib);
el_bind_key('?', list_possible);
el_bind_key(CTL('C'), do_break);
el_bind_key(CTL('D'), do_exit);
el_bind_key(CTL('Z'), do_suspend);
read_history(HISTORY);
while ((line = readline(prompt))) {
int next = 0;
if (!strncmp(line, "unlock", 6)) {
el_no_echo = 1;
while ((line = readline(passwd))) {
if (strncmp(line, "secret", 6)) {
printf("\nWrong password, please try again, it's secret.\n");
continue;
}
el_no_echo = 0;
printf("\nAchievement unlocked!\n");
next = 1;
break;
}
}
if (next)
continue;
printf("\t\t\t|%s|\n", line);
free(line);
}
return 0;
} The only constructs necessary, IMHO, are |
It can break BitShares Core stuff that is used already by different 3rd parties, so I need to check your idea ... Thanks ! |
I've checked your |
I see, well editline is a line based library. Adding magic to trigger In all honesty, I cannot justify that complexity in editline just for the sake of one user (application) of the library. |
ok sure, as you wish, Thanks ! |
I'm sorry for denying your pull request(s) so late, considering all the work you've put in. Hope you can find a good solution for the application! |
this is a good solution, we just will fork this project with my changes, because we don't need to break our 3rd parties apps and services. No worries ! Thank you ! |
Just little improvements. As discussed here bitshares/bitshares-core#1382
(as commented here also bitshares/bitshares-core#1382 (comment))
Please check this improvement. Thanks !