[partition] Check minimum password length for zfs encryption
This commit is contained in:
parent
f156fc3562
commit
d45819d552
@ -464,6 +464,18 @@ ChoicePage::continueApplyDeviceChoice()
|
||||
void
|
||||
ChoicePage::onActionChanged()
|
||||
{
|
||||
if ( m_enableEncryptionWidget )
|
||||
{
|
||||
if ( m_config->installChoice() == InstallChoice::Erase && m_eraseFsTypesChoiceComboBox )
|
||||
{
|
||||
m_encryptWidget->setFilesystem( m_eraseFsTypesChoiceComboBox->currentText() );
|
||||
}
|
||||
else if ( m_config->installChoice() == InstallChoice::Replace && m_replaceFsTypesChoiceComboBox )
|
||||
{
|
||||
m_encryptWidget->setFilesystem( m_replaceFsTypesChoiceComboBox->currentText() );
|
||||
}
|
||||
}
|
||||
|
||||
Device* currd = selectedDevice();
|
||||
if ( currd )
|
||||
{
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "Branding.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Retranslator.h"
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
|
||||
constexpr uint ZFS_MIN_LENGTH = 8;
|
||||
|
||||
/** @brief Does this system support whole-disk encryption?
|
||||
*
|
||||
@ -150,11 +153,17 @@ EncryptWidget::updateState()
|
||||
QString p1 = m_ui->m_passphraseLineEdit->text();
|
||||
QString p2 = m_ui->m_confirmLineEdit->text();
|
||||
|
||||
|
||||
if ( p1.isEmpty() && p2.isEmpty() )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
else if ( FileSystem::typeForName( m_filesystem ) == FileSystem::Zfs && p1.length() < ZFS_MIN_LENGTH )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Password must be a minimum of %1 characters" ).arg( ZFS_MIN_LENGTH ) );
|
||||
}
|
||||
else if ( p1 == p2 )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
||||
@ -201,3 +210,10 @@ EncryptWidget::onCheckBoxStateChanged( int checked )
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::setFilesystem( const QString& fs )
|
||||
{
|
||||
m_filesystem = fs;
|
||||
updateState();
|
||||
}
|
||||
|
@ -38,6 +38,12 @@ public:
|
||||
Encryption state() const;
|
||||
void setText( const QString& text );
|
||||
|
||||
/**
|
||||
* @brief setFilesystem sets the filesystem name used for password validation
|
||||
* @param fs A QString containing the name of the filesystem
|
||||
*/
|
||||
void setFilesystem( const QString& fs );
|
||||
|
||||
QString passphrase() const;
|
||||
|
||||
void retranslate();
|
||||
@ -52,6 +58,8 @@ private:
|
||||
|
||||
Ui::EncryptWidget* m_ui;
|
||||
Encryption m_state;
|
||||
|
||||
QString m_filesystem;
|
||||
};
|
||||
|
||||
#endif // ENCRYPTWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user