Fix a bug: wait for promise before displaying message for clipboard pasted password
This commit is contained in:
parent
4cfd61d077
commit
12d49fab4e
|
@ -69,14 +69,18 @@ function _query_tabs_get_password(tabs)
|
||||||
function(arg)
|
function(arg)
|
||||||
{
|
{
|
||||||
debug("Response to setPassword " + arg);
|
debug("Response to setPassword " + arg);
|
||||||
if (arg == "" || force_copy)
|
if (arg === "" || force_copy)
|
||||||
{
|
{
|
||||||
navigator.clipboard.writeText(response.password);
|
navigator.clipboard.writeText(response.password).then(function() {
|
||||||
notify("Password pasted into clipboard", "");
|
notify("Password pasted into clipboard", "");
|
||||||
|
window.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
notify("Password filled", "");
|
notify("Password filled", "");
|
||||||
window.close();
|
window.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ var username_filled = false
|
||||||
|
|
||||||
function _query_tabs_get_password(tabs)
|
function _query_tabs_get_password(tabs)
|
||||||
{
|
{
|
||||||
|
var force_copy = false;
|
||||||
|
|
||||||
if (tabs.length <= 0) return;
|
if (tabs.length <= 0) return;
|
||||||
|
|
||||||
var username = document.getElementById("gPassUsername").value;
|
var username = document.getElementById("gPassUsername").value;
|
||||||
|
@ -32,6 +34,10 @@ function _query_tabs_get_password(tabs)
|
||||||
document.getElementById("gPassMasterKey").value = "";
|
document.getElementById("gPassMasterKey").value = "";
|
||||||
|
|
||||||
var do_submit = !mkey.startsWith("@_") && username_filled;
|
var do_submit = !mkey.startsWith("@_") && username_filled;
|
||||||
|
|
||||||
|
if (mkey.startsWith("@_"))
|
||||||
|
force_copy = true;
|
||||||
|
|
||||||
if (mkey.startsWith("@@") || mkey.startsWith("@_"))
|
if (mkey.startsWith("@@") || mkey.startsWith("@_"))
|
||||||
mkey = mkey.substring(2);
|
mkey = mkey.substring(2);
|
||||||
|
|
||||||
|
@ -63,14 +69,18 @@ function _query_tabs_get_password(tabs)
|
||||||
function(arg)
|
function(arg)
|
||||||
{
|
{
|
||||||
debug("Response to setPassword " + arg);
|
debug("Response to setPassword " + arg);
|
||||||
if (arg == "")
|
if (arg === "" || force_copy)
|
||||||
{
|
{
|
||||||
navigator.clipboard.writeText(response.password);
|
navigator.clipboard.writeText(response.password).then(function() {
|
||||||
notify("Password pasted into clipboard", "");
|
notify("Password pasted into clipboard", "");
|
||||||
|
window.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
notify("Password filled", "");
|
notify("Password filled", "");
|
||||||
window.close();
|
window.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user