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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions chrome/background.browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ function onMessage(request, sender, sendResponse) {
text = response.p;
} else if (request.what === "username") {
text = response.u;
} else if (request.what === "otp") {
if (!response.digits) {
sendResponse({status: "ERROR", error:
"Unable to determine the OTP code for this entry."
});
return;
}
text = response.digits;
}

try {
Expand Down
4 changes: 4 additions & 0 deletions chrome/icon-otp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions chrome/script.browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ function view() {
onclick: loginToClipboard.bind({ entry: login, what: "password" }),
title: "Copy password",
tabindex: -1
}),
m("button.copy.otp", {
onclick: loginToClipboard.bind({ entry: login, what: "otp" }),
title: "Copy OTP code",
tabindex: -1
})
]);
});
Expand Down
5 changes: 5 additions & 0 deletions chrome/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ body {
background-size: 16px 16px;
}

.otp {
background: no-repeat url('icon-otp.svg') center;
background-size: 16px 16px;
}

.login {
display: flex;
flex: 1;
Expand Down