From 01b22d27a8cc7d8447d554d8162613f2c4b4a992 Mon Sep 17 00:00:00 2001 From: apt-ghetto Date: Sat, 25 Jul 2020 15:59:59 +0200 Subject: [PATCH] Do not allow 'root' as username On the "Users" tab, the user can choose a username. It was possible to use 'root' as username, which led to an installation error, because 'root' exists already. Added a new check to the username validation. Fixes #1462. --- src/modules/users/UsersPage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index 9c7ce6f7b..5c649d622 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -409,6 +409,13 @@ UsersPage::validateUsernameText( const QString& textRef ) tr( "Only lowercase letters, numbers, underscore and hyphen are allowed." ) ); m_readyUsername = false; } + else if ( 0 == QString::compare("root", text, Qt::CaseSensitive ) ) + { + labelError( ui->labelUsername, + ui->labelUsernameError, + tr( "'root' is not allowed as user name." ) ); + m_readyUsername = false; + } else { labelOk( ui->labelUsername, ui->labelUsernameError );