Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Copy OTP button added to the search results #257

Merged
merged 3 commits into from
Apr 19, 2018
Merged

Copy OTP button added to the search results #257

merged 3 commits into from
Apr 19, 2018

Conversation

myelsukov
Copy link
Contributor

Changes to be committed:
modified: chrome/background.browserify.js
new file: chrome/icon-otp.svg
modified: chrome/script.browserify.js
modified: chrome/styles.css
Icon is pulled from https://github.com/danklammer/bytesize-icons/blob/master/dist/icons/clock.svg

 Changes to be committed:
	modified:   chrome/background.browserify.js
	new file:   chrome/icon-otp.svg
	modified:   chrome/script.browserify.js
	modified:   chrome/styles.css
@@ -112,6 +112,8 @@ function onMessage(request, sender, sendResponse) {
text = response.p;
} else if (request.what === "username") {
text = response.u;
} else if (request.what === "otp") {
text = response.digits;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just realized that a large majority of users don't use OTP in browserpass (I know maybe of 5 people in total), and with this change everyone will see a new button in front of every record that literally does nothing.

Adding it is probably fine, because you could argue "I personally don't use launch URL / copy username buttons, so what", but I think at the very least it should not act as if the copy was successful. If this entry did not have OTP code, instead of silently closing, let's show an error - similar to what happens when you try to launch a URL and the URL is not found.

Something like this:

if (!response.digits) {
  sendResponse({
    status: "ERROR",
    error:
      "Unable to determine the OTP code for this entry."
  });
  return;
}

/cc @erayd maybe we could consider making which buttons are visible configurable in v3. Especially if we will be adding new fields (credit card, address, etc - see #187), at some point users will want to have the corresponding buttons, but it doesn't make sense to show them to everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I will add it.

}),
m("button.copy.otp", {
onclick: loginToClipboard.bind({ entry: login, what: "otp" }),
title: "Copy OTP",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally more used to seeing "OTP code" phrase, not sure if it is correct, but if you don't care (😃), could I please have "Copy OTP code" hint here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely don't mind. I am back-end engineer, so historically I don't care about UI :)

@erayd
Copy link
Contributor

erayd commented Apr 19, 2018

@maximbaz What if we added a right-click menu, which loaded the file before displaying, so that we know which options are available?

We can't decrypt every file to figure out which buttons to display (because decryption is slow), but we can certainly decrypt one.

@maximbaz
Copy link
Member

I like that, noted for v3 😉

@myelsukov
Copy link
Contributor Author

Suggested changes have been implemented. Please review.

Copy link
Member

@maximbaz maximbaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you very much 😉

@maximbaz maximbaz merged commit 57e017d into browserpass:master Apr 19, 2018
@myelsukov
Copy link
Contributor Author

My pleasure!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants