[users] implement upstream fixes
This commit is contained in:
parent
846a4a19ae
commit
ec44f2e4f4
@ -8,7 +8,7 @@ The following settings are available in **users.conf**:
|
||||
|
||||
- ```defaultGroups```: list of groups every user will be added to.
|
||||
- ```autologinGroup```: group to add the user with autologin to, if any.
|
||||
- ```doAutologin```: allow for users with autologin (at most one per system). Defaults to false.
|
||||
- ```doAutologin```: if autologin is allowed, set it to "yes" by default. Defaults to false.
|
||||
- ```sudoersGroup```: group for sudoers usage.
|
||||
- ```setRootPassword```: allow to set the root password in the installed system. Defaults to false.
|
||||
- ```availableShells```: comma-separated list of available shells for new users. If not present, new users will not have any explicit shell in /etc/passwd, therefore the system default (usually, /bin/bash) will be used.
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "AddUserDialog.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
|
||||
AddUserDialog::AddUserDialog(const QStringList& existingUsers, bool avatar, bool autologin, const QStringList& shells, bool haveRootPassword, QWidget* parent)
|
||||
AddUserDialog::AddUserDialog(const QStringList& existingUsers, bool avatar, bool allowAutologin, bool checkAutologin, const QStringList& shells, bool haveRootPassword, QWidget* parent)
|
||||
: QDialog(parent),
|
||||
m_existingUsers(existingUsers)
|
||||
{
|
||||
@ -80,8 +80,10 @@ AddUserDialog::AddUserDialog(const QStringList& existingUsers, bool avatar, bool
|
||||
ui.rootUsesUserPwCheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
if (!autologin) {
|
||||
if (!allowAutologin) {
|
||||
ui.autoLoginCheckBox->setEnabled(false);
|
||||
} else {
|
||||
ui.autoLoginCheckBox->setChecked(checkAutologin);
|
||||
}
|
||||
|
||||
if (!avatar) {
|
||||
@ -106,7 +108,7 @@ void AddUserDialog::accept() {
|
||||
shell = ui.loginShellSelection->currentText();
|
||||
fullName = ui.nameLine->text();
|
||||
|
||||
autoLogin = ui.autoLoginCheckBox->isEnabled();
|
||||
autoLogin = ui.autoLoginCheckBox->isChecked();
|
||||
useUserPw = ui.rootUsesUserPwCheckBox->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
|
@ -38,10 +38,11 @@ public:
|
||||
* - existingUsers: username of the users that were already created.
|
||||
* This avoids us creating a second one with the same name.
|
||||
* - avatar: whether we should allow to choose an avatar.
|
||||
* - autologin: whether we should allow the autologin option.
|
||||
* - allowAutologin: whether we should allow the autologin option.
|
||||
* - checkAutologin: if allowAutologin is true, will it be checked by default or not? Ignored if false.
|
||||
* - shells: the available login shells for users.
|
||||
*/
|
||||
AddUserDialog(const QStringList &existingUsers, bool avatar, bool autologin, const QStringList &shells, bool haveRootPassword, QWidget *parent = 0);
|
||||
AddUserDialog(const QStringList &existingUsers, bool avatar, bool allowAutologin, bool checkAutologin, const QStringList &shells, bool haveRootPassword, QWidget *parent = 0);
|
||||
virtual ~AddUserDialog();
|
||||
|
||||
QString login;
|
||||
|
@ -141,6 +141,7 @@ UsersPage::UsersPage( QWidget* parent )
|
||||
, ui( new Ui::UserCreation )
|
||||
, m_readyHostname( false )
|
||||
, m_readyRootPassword( false )
|
||||
, m_autologin( false )
|
||||
, m_haveRootPassword( true )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
@ -179,12 +180,11 @@ UsersPage::addUserClicked() {
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow autologin if the module configuration allows it,
|
||||
// and there exists no other users with autologin enabled.
|
||||
bool allowAutologin = m_autologin && !userHasAutologin;
|
||||
// Only allow autologin if there exists no other users with autologin enabled.
|
||||
bool allowAutologin = !userHasAutologin;
|
||||
|
||||
QPointer<AddUserDialog> dlg = new AddUserDialog(
|
||||
existingUsers, !m_avatarFilePath.isEmpty(), allowAutologin, m_availableShells, m_haveRootPassword, this );
|
||||
existingUsers, !m_avatarFilePath.isEmpty(), allowAutologin, m_autologin, m_availableShells, m_haveRootPassword, this );
|
||||
|
||||
if ( dlg->exec() == QDialog::Accepted ) {
|
||||
addUser(dlg->login, dlg->fullName, dlg->password, dlg->shell, dlg->avatarFile, dlg->autoLogin);
|
||||
|
@ -130,9 +130,13 @@ private:
|
||||
bool m_readyHostname;
|
||||
bool m_readyRootPassword;
|
||||
|
||||
// Check autologin by default (if no other user is already in autologin mode)?
|
||||
bool m_autologin;
|
||||
// Allow to set a root password?
|
||||
bool m_haveRootPassword;
|
||||
// Path to copy the avatar file to, if the user selects one.
|
||||
QString m_avatarFilePath;
|
||||
// List of available shells for new users.
|
||||
QStringList m_availableShells;
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,45 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="confirmPassLine">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6" rowspan="4" colspan="2">
|
||||
<widget class="QLabel" name="confirmPwCheck">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" rowspan="4">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
@ -84,16 +123,32 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Confirm Password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<item row="0" column="4" rowspan="3" colspan="2">
|
||||
<widget class="QLineEdit" name="passLine">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="4">
|
||||
<layout class="QVBoxLayout" name="userNameLayout">
|
||||
<item>
|
||||
@ -154,7 +209,7 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -174,61 +229,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="confirmPassLine">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" rowspan="3" colspan="2">
|
||||
<widget class="QLineEdit" name="passLine">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6" rowspan="4" colspan="2">
|
||||
<widget class="QLabel" name="confirmPwCheck">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>694</width>
|
||||
<height>474</height>
|
||||
<height>475</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -109,7 +109,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>248</height>
|
||||
<height>249</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -233,13 +233,13 @@
|
||||
<widget class="QLabel" name="labelHostname">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -252,7 +252,7 @@
|
||||
<widget class="QLabel" name="labelRootPwIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user