Poweroff if device lock down

This commit is contained in:
Nicolas Mailloux 2021-10-10 17:01:26 -04:00
parent d8d3176587
commit 222281cf28
2 changed files with 16 additions and 3 deletions

View file

@ -214,9 +214,10 @@ void encryptionManager::unlockEncryptedStorage() {
string_writeconfig("/inkbox/encryptedStoragePassphraseTries", "3");
unsigned long currentEpoch = QDateTime::currentSecsSinceEpoch();
currentEpoch += 86400;
std::string unlockTime_str = to_string(currentEpoch);
global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString();
std::string unlockTime_str = global::encfs::unlockTime.toStdString();
qDebug() << "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime;
QString message = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime;
qDebug() << message;
string_writeconfig("/external_root/boot/flags/ENCRYPT_LOCK", unlockTime_str);
global::encfs::lockdown = true;
setupMessageBoxRan = true;
@ -224,6 +225,7 @@ void encryptionManager::unlockEncryptedStorage() {
alertWindow = new alert();
alertWindow->setAttribute(Qt::WA_DeleteOnClose);
alertWindow->showFullScreen();
poweroff(false);
}
if(passphraseTries <= 2) {

View file

@ -142,7 +142,12 @@ reader::reader(QWidget *parent) :
}
else {
if(checkconfig("/opt/inkbox_genuine") == true) {
QDir::setCurrent("/mnt/onboard/onboard");
if(checkconfig("/external_root/run/encfs_mounted") == true) {
QDir::setCurrent("/mnt/onboard/onboard/encfs-decrypted");
}
else {
QDir::setCurrent("/mnt/onboard/onboard");
}
QFileDialog *dialog = new QFileDialog(this);
// https://forum.qt.io/topic/29471/solve-how-to-show-qfiledialog-at-center-position-screen/4
QDesktopWidget desk;
@ -162,6 +167,12 @@ reader::reader(QWidget *parent) :
}
}
else {
if(checkconfig("/external_root/run/encfs_mounted") == true) {
QDir::setCurrent("/mnt/onboard/onboard/encfs-decrypted");
}
else {
QDir::setCurrent("/mnt/onboard/onboard");
}
QDir::setCurrent("/mnt/onboard");
QFileDialog *dialog = new QFileDialog(this);
// https://forum.qt.io/topic/29471/solve-how-to-show-qfiledialog-at-center-position-screen/4