mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:46:41 +00:00
UI: WindowManager: Improve checkPassword()
This commit is contained in:
parent
0dfd762620
commit
968b3390eb
@ -273,7 +273,7 @@ bool ControlManager::processCommandProgAction(const ProcessCommandArgs &p, bool
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoC<WindowManager>()->checkPassword()) {
|
||||
if (!IoC<WindowManager>()->checkPassword(/*temporary=*/true)) {
|
||||
p.errorMessage = "Password required";
|
||||
return false;
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ bool WindowManager::checkWindowPassword(WindowCode code)
|
||||
return (WindowPasswordProtected & code) == 0 || checkPassword();
|
||||
}
|
||||
|
||||
bool WindowManager::checkPassword()
|
||||
bool WindowManager::checkPassword(bool temporary)
|
||||
{
|
||||
if (isAnyWindowOpen(WindowPasswordDialog)) {
|
||||
activateModalWidget();
|
||||
@ -627,14 +627,22 @@ bool WindowManager::checkPassword()
|
||||
|
||||
QString password;
|
||||
int unlockType = FortSettings::UnlockDisabled;
|
||||
if (showPasswordDialog(password, &unlockType) && IoC<ConfManager>()->checkPassword(password)) {
|
||||
settings->setPasswordChecked(
|
||||
/*checked=*/true, static_cast<FortSettings::UnlockType>(unlockType));
|
||||
bool passwordChecked = false;
|
||||
|
||||
if (showPasswordDialog(password, &unlockType) // input the password
|
||||
&& IoC<ConfManager>()->checkPassword(password)) {
|
||||
|
||||
if (!temporary || unlockType != FortSettings::UnlockWindow) {
|
||||
settings->setPasswordChecked(
|
||||
/*checked=*/true, FortSettings::UnlockType(unlockType));
|
||||
}
|
||||
|
||||
passwordChecked = true;
|
||||
}
|
||||
|
||||
windowClosed(WindowPasswordDialog);
|
||||
|
||||
return settings->passwordChecked();
|
||||
return passwordChecked;
|
||||
}
|
||||
|
||||
void WindowManager::showErrorBox(const QString &text, const QString &title, QWidget *parent)
|
||||
|
@ -120,7 +120,7 @@ public slots:
|
||||
void processRestartRequired(const QString &info = {});
|
||||
|
||||
bool checkWindowPassword(WindowCode code);
|
||||
bool checkPassword();
|
||||
bool checkPassword(bool temporary = false);
|
||||
|
||||
virtual void showErrorBox(
|
||||
const QString &text, const QString &title = QString(), QWidget *parent = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user