mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-01 19:47:39 +03:00
Add safeguards to secure input on macOS
* Fixes #11906 * Disable secure input when password widget is hidden as well as focused out * Add safeguard to ensure the internal counter that macOS keeps is always set to 1 preventing the ability to disable secure input by focus/unfocus a password field
This commit is contained in:
parent
37ddbb3cd2
commit
2a18b84b05
2 changed files with 8 additions and 1 deletions
|
@ -231,7 +231,7 @@ bool PasswordWidget::eventFilter(QObject* watched, QEvent* event)
|
|||
if (isVisible() && (type == QEvent::KeyPress || type == QEvent::KeyRelease || type == QEvent::FocusIn)) {
|
||||
checkCapslockState();
|
||||
}
|
||||
if (type == QEvent::FocusIn || type == QEvent::FocusOut) {
|
||||
if (type == QEvent::FocusIn || type == QEvent::FocusOut || type == QEvent::Hide) {
|
||||
osUtils->setUserInputProtection(type == QEvent::FocusIn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,11 +152,18 @@ bool MacUtils::isCapslockEnabled()
|
|||
|
||||
void MacUtils::setUserInputProtection(bool enable)
|
||||
{
|
||||
static bool secureInputEnabled = false;
|
||||
if (enable) {
|
||||
// Always keep the internal counter set to 1
|
||||
if (secureInputEnabled) {
|
||||
DisableSecureEventInput();
|
||||
}
|
||||
EnableSecureEventInput();
|
||||
} else {
|
||||
DisableSecureEventInput();
|
||||
}
|
||||
// Store our last known state
|
||||
secureInputEnabled = enable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue