fanglingsu / vimb

Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim. The goal of vimb is to build a completely keyboard-driven, efficient and pleasurable browsing-experience.
https://fanglingsu.github.io/vimb/
GNU General Public License v3.0
1.34k stars 100 forks source link

How to implement password autofill #609

Closed TAAPArthur closed 4 years ago

TAAPArthur commented 4 years ago

Want to clarify that I don't want a password manager built in. The only main feature vimb lacks from a mainstream browser for me is the ability to autofill username/password info. I have standalone password manager/script that given the url will output the password.

Since I don't believe there is a way to directly use the output of a command in vimb, my thought process was to run the script and save the output to a clipboard (primary buffer to be specific) and then run something like gi <Esc> *p to go to the input filed, go back to normal mode and the paste from the clipboard.

I didn't see a way to cleanly paste from the register. Not married to the idea but wasn't sure how else to do it besides having a external program just type the username, password and commands to switch between, which seems hacky.

Any suggestions?

iamleot commented 4 years ago

Hello TAAPArthur,

TAAPArthur writes:

Want to clarify that I don't want a password manager built in. The only main feature vimb lacks from a mainstream browser for me is the ability to autofill username/password info. I have standalone password manager/script that given the url will output the password.

Since I don't believe there is a way to directly use the output of a command in vimb, my thought process was to run the script and save the output to a clipboard (primary buffer to be specific) and then run something like gi <Esc> *p to go to the input filed, go back to normal mode and the paste from the clipboard.

I didn't see a way to cleanly paste from the register. Not married to the idea but wasn't sure how else to do it besides having a external program just type the username, password and commands to switch between, which seems hacky.

Any suggestions? [...]

Doesn't completely address your question but to avoid storing password to the clipboard and pasting it I use (where `pass show "${password_name}"' select the corresponding password and print it):

{ printf "type --clearmodifiers -- " ; pass show "${password_name}" | head -n 1 ; } | xdotool -

If you are more curious you can find the full script on:

gopher://tccr.it/1/r/localbin/file/passmenu.gph

fanglingsu commented 4 years ago

@TAAPArthur In the older version of vimb with socket support there was a little script to to form filling https://github.com/fanglingsu/vimb/blob/a88f4b90a593e16b7a94a8147554ebb6893d88a6/examples/formfiller/formfiller that used JavaScript to fill given data into the form fields. The JS was run as e! ... from inputbox. The related script.js is this https://github.com/fanglingsu/vimb/blob/a88f4b90a593e16b7a94a8147554ebb6893d88a6/examples/formfiller/scripts.js But this does not answer your question because it lags the poitn how to get the data from script into the browser. For this I would follow @iamleot and writing the data from script via xdotool into vimb inpubbox as JS call like ::e! _vbform.fill(["input[name='login']:daniel","input[name='password']:p45w0rD"]); or write it direct into focused form field.

TAAPArthur commented 4 years ago

Thank you for taking the time to respond.

I was intending to autofill the username and password and found it difficult to type a character to goto the correct form. Ended up using a hybrid of the two approaches. password-menu type $VIMB_URI $VIMB_XID ':eval! _myFill("\%s","\%s");' <CR><Esc> where password-menu accepts the URL WindowId and the an argument it will blindly pass into printf along with the username and password which will get passed to xdotool to type.

The _myFill function behaves similarly to the suggestion, but uses type to find the password field instead of name, and then finds the an input field in the same form for the login/username.

Gotta say I thought vimb was missing features, but I seem to be able to do everything I want.