Implemented hotkeys (option/enter and command/enter) to support separate username or password entry. Fixes #1017

This commit is contained in:
Dennis Ploeger 2018-10-12 12:31:04 +02:00
parent 4a070bbc57
commit e23beaf831
3 changed files with 21 additions and 2 deletions

View File

@ -70,7 +70,14 @@ const AutoType = {
run(entry, callback) {
this.running = true;
const sequence = entry.getEffectiveAutoTypeSeq();
var sequence;
if (entry.autoTypeOption === 'password') {
sequence = '{PASSWORD}';
} else if (entry.autoTypeOption === 'username') {
sequence = '{USERNAME}';
} else {
sequence = entry.getEffectiveAutoTypeSeq();
}
logger.debug('Start', sequence);
const ts = logger.ts();
try {

View File

@ -12,7 +12,7 @@ const KeyHandler = {
modal: false,
init: function() {
$(document).bind('keypress', this.keypress.bind(this));
$(document).bind('keyxpress', this.keypress.bind(this));
$(document).bind('keydown', this.keydown.bind(this));
this.shortcuts[Keys.DOM_VK_A] = [{ handler: this.handleAKey, thisArg: this, shortcut: this.SHORTCUT_ACTION,

View File

@ -26,6 +26,8 @@ const AutoTypePopupView = Backbone.View.extend({
this.listenTo(Backbone, 'main-window-will-close', this.mainWindowWillClose);
KeyHandler.onKey(Keys.DOM_VK_ESCAPE, this.escPressed, this, false, true);
KeyHandler.onKey(Keys.DOM_VK_RETURN, this.enterPressed, this, false, true);
KeyHandler.onKey(Keys.DOM_VK_RETURN, this.actionEnterPressed, this, KeyHandler.SHORTCUT_ACTION, true);
KeyHandler.onKey(Keys.DOM_VK_RETURN, this.optEnterPressed, this, KeyHandler.SHORTCUT_OPT, true);
KeyHandler.onKey(Keys.DOM_VK_UP, this.upPressed, this, false, true);
KeyHandler.onKey(Keys.DOM_VK_DOWN, this.downPressed, this, false, true);
KeyHandler.onKey(Keys.DOM_VK_BACK_SPACE, this.backSpacePressed, this, false, true);
@ -97,6 +99,16 @@ const AutoTypePopupView = Backbone.View.extend({
this.closeWithResult();
},
actionEnterPressed() {
this.result.autoTypeOption = 'password';
this.closeWithResult();
},
optEnterPressed() {
this.result.autoTypeOption = 'username';
this.closeWithResult();
},
upPressed(e) {
e.preventDefault();
const activeIndex = this.entries.indexOf(this.result) - 1;