[users] Drop data-access from the Page
- get username, password etc. from the config object, not the page - jobs now depend entirely on config - handle logic of "what's the root password" in Config
This commit is contained in:
parent
eb72d662d1
commit
b49b9a66e6
@ -437,6 +437,28 @@ Config::setRootPasswordSecondary( const QString& s )
|
||||
}
|
||||
}
|
||||
|
||||
QString Config::rootPassword() const
|
||||
{
|
||||
if ( writeRootPassword() )
|
||||
{
|
||||
if ( reuseUserPasswordForRoot() )
|
||||
return userPassword();
|
||||
return m_rootPassword;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString Config::rootPasswordSecondary() const
|
||||
{
|
||||
if ( writeRootPassword() )
|
||||
{
|
||||
if ( reuseUserPasswordForRoot() )
|
||||
return userPasswordSecondary();
|
||||
return m_rootPasswordSecondary;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
STATICTEST void
|
||||
setConfigurationDefaultGroups( const QVariantMap& map, QStringList& defaultGroups )
|
||||
|
@ -130,10 +130,14 @@ public:
|
||||
*/
|
||||
bool isPasswordAcceptable( const QString& password, QString& message );
|
||||
|
||||
// The user enters a password (and again in a separate UI element)
|
||||
QString userPassword() const { return m_userPassword; }
|
||||
QString userPasswordSecondary() const { return m_userPasswordSecondary; }
|
||||
QString rootPassword() const { return m_rootPassword; }
|
||||
QString rootPasswordSecondary() const { return m_rootPasswordSecondary; }
|
||||
// The root password **may** be entered in the UI, or may be suppressed
|
||||
// entirely when writeRootPassword is off, or may be equal to
|
||||
// the user password when reuseUserPasswordForRoot is on.
|
||||
QString rootPassword() const;
|
||||
QString rootPasswordSecondary() const;
|
||||
|
||||
static const QStringList& forbiddenLoginNames();
|
||||
static const QStringList& forbiddenHostNames();
|
||||
|
@ -199,32 +199,6 @@ UsersPage::isReady() const
|
||||
return readyFields;
|
||||
}
|
||||
|
||||
QString
|
||||
UsersPage::getRootPassword() const
|
||||
{
|
||||
if ( m_config->writeRootPassword() )
|
||||
{
|
||||
if ( ui->checkBoxReusePassword->isChecked() )
|
||||
{
|
||||
return ui->textBoxUserPassword->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
return ui->textBoxRootPassword->text();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QPair< QString, QString >
|
||||
UsersPage::getUserPassword() const
|
||||
{
|
||||
return QPair< QString, QString >( m_config->loginName(), ui->textBoxUserPassword->text() );
|
||||
}
|
||||
|
||||
void
|
||||
UsersPage::fillGlobalStorage() const
|
||||
{
|
||||
|
@ -48,11 +48,6 @@ public:
|
||||
|
||||
void onActivate();
|
||||
|
||||
///@brief Root password, depends on settings, may be empty
|
||||
QString getRootPassword() const;
|
||||
///@brief User name and password
|
||||
QPair< QString, QString > getUserPassword() const;
|
||||
|
||||
protected slots:
|
||||
void onFullNameTextEdited( const QString& );
|
||||
void reportLoginNameStatus( const QString& );
|
||||
|
@ -132,11 +132,10 @@ UsersViewStep::onLeave()
|
||||
m_config->doAutoLogin(),
|
||||
m_config->defaultGroups() );
|
||||
|
||||
auto userPW = m_widget->getUserPassword();
|
||||
j = new SetPasswordJob( userPW.first, userPW.second );
|
||||
j = new SetPasswordJob( m_config->loginName(), m_config->userPassword() );
|
||||
m_jobs.append( Calamares::job_ptr( j ) );
|
||||
|
||||
j = new SetPasswordJob( "root", m_widget->getRootPassword() );
|
||||
j = new SetPasswordJob( "root", m_config->rootPassword() );
|
||||
m_jobs.append( Calamares::job_ptr( j ) );
|
||||
|
||||
// TODO: Config object should create jobs
|
||||
|
Loading…
Reference in New Issue
Block a user