Allow reusing the user password as root password.

This commit is contained in:
Teo Mrnjavac 2015-10-16 14:25:41 +02:00
parent 97bc1f71ea
commit bbd8fe6203
2 changed files with 154 additions and 176 deletions

View File

@ -66,11 +66,22 @@ UsersPage::UsersPage( QWidget* parent )
this, &UsersPage::onRootPasswordTextChanged );
connect( ui->textBoxVerifiedRootPassword, &QLineEdit::textChanged,
this, &UsersPage::onRootPasswordTextChanged );
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged,
this, [this]( int checked )
{
ui->labelChooseRootPassword->setVisible( !checked );
ui->labelExtraRootPassword->setVisible( !checked );
ui->labelRootPassword->setVisible( !checked );
ui->labelRootPasswordError->setVisible( !checked );
ui->textBoxRootPassword->setVisible( !checked );
ui->textBoxVerifiedRootPassword->setVisible( !checked );
} );
m_customUsername = false;
m_customHostname = false;
setShowRootPassword( true );
ui->checkBoxReusePassword->setChecked( true );
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
}
@ -88,7 +99,7 @@ UsersPage::isReady()
return m_readyFullName &&
m_readyHostname &&
m_readyPassword &&
( !m_showRootPassword || m_readyRootPassword ) &&
( !m_showRootPassword || ( ui->checkBoxReusePassword->isChecked() || m_readyRootPassword ) ) &&
m_readyUsername;
}
@ -105,7 +116,7 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
ui->textBoxFullName->text().isEmpty() ?
ui->textBoxUsername->text() :
ui->textBoxFullName->text(),
ui->checkBoxLoginAuto->isChecked(),
ui->checkBoxAutoLogin->isChecked(),
defaultUserGroup,
defaultGroupsList );
list.append( Calamares::job_ptr( j ) );
@ -116,6 +127,10 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
if ( m_showRootPassword )
{
if ( ui->checkBoxReusePassword->isChecked() )
j = new SetPasswordJob( "root",
ui->textBoxUserPassword->text() );
else
j = new SetPasswordJob( "root",
ui->textBoxRootPassword->text() );
list.append( Calamares::job_ptr( j ) );
@ -126,7 +141,7 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "hostname", ui->textBoxHostname->text() );
if ( ui->checkBoxLoginAuto->isChecked() )
if ( ui->checkBoxAutoLogin->isChecked() )
gs->insert( "autologinUser", ui->textBoxUsername->text() );
gs->insert( "username", ui->textBoxUsername->text() );
@ -146,13 +161,7 @@ UsersPage::onActivate()
void
UsersPage::setShowRootPassword( bool show )
{
ui->labelChooseRootPassword->setVisible( show );
ui->labelExtraRootPassword->setVisible( show );
ui->labelRootPassword->setVisible( show );
ui->labelRootPasswordError->setVisible( show );
ui->textBoxRootPassword->setVisible( show );
ui->textBoxVerifiedRootPassword->setVisible( show );
ui->checkBoxReusePassword->setVisible( show );
m_showRootPassword = show;
}
@ -415,6 +424,5 @@ UsersPage::onRootPasswordTextChanged( const QString& )
void
UsersPage::setAutologinDefault( bool checked )
{
ui->checkBoxLoginAuto->setChecked( checked );
ui->checkBoxLoginNormal->setChecked( !checked );
ui->checkBoxAutoLogin->setChecked( checked );
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>862</width>
<height>597</height>
<height>683</height>
</rect>
</property>
<property name="windowTitle">
@ -19,10 +19,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -97,10 +100,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -199,14 +205,126 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="hostname_label_2">
<property name="text">
<string>What is the name of this computer?</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="textBoxHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostnameError">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="hostname_extra_label_2">
<property name="styleSheet">
<string>font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
@ -327,120 +445,31 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<widget class="QCheckBox" name="checkBoxAutoLogin">
<property name="text">
<string>Log in automatically without asking for the password.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxReusePassword">
<property name="text">
<string>Use the same password for the administrator account.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="hostname_label_2">
<property name="text">
<string>What is the name of this computer?</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="textBoxHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostnameError">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="hostname_extra_label_2">
<property name="styleSheet">
<string>font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -560,61 +589,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QWidget" name="widget_7" native="true">
<layout class="QGridLayout" name="gridLayout_10">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item row="0" column="1">
<widget class="QRadioButton" name="checkBoxLoginAuto">
<property name="text">
<string>&amp;Log in automatically</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="checkBoxLoginNormal">
<property name="text">
<string>Require &amp;my password to log in</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
@ -630,10 +604,6 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>checkBoxLoginNormal</tabstop>
<tabstop>checkBoxLoginAuto</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>