Revert "Update AccessControl.cpp"

This reverts commit ae335e9c22.
This commit is contained in:
Alexey Milovidov 2022-11-26 02:42:14 +01:00
parent d45e49ead5
commit 114d77d8e8

View File

@ -445,8 +445,6 @@ AccessChangesNotifier & AccessControl::getChangesNotifier()
UUID AccessControl::authenticate(const Credentials & credentials, const Poco::Net::IPAddress & address) const
{
chassert(!credentials.getUserName().empty());
try
{
return MultipleAccessStorage::authenticate(credentials, address, *external_authenticators, allow_no_password,
@ -461,7 +459,7 @@ UUID AccessControl::authenticate(const Credentials & credentials, const Poco::Ne
/// Better exception message for usability.
/// It is typical when users install ClickHouse, type some password and instantly forget it.
if (credentials.getUserName() == "default")
if (credentials.getUserName().empty() || credentials.getUserName() == "default")
message << "\n\n"
<< "If you have installed ClickHouse and forgot password you can reset it in the configuration file.\n"
<< "The password for default user is typically located at /etc/clickhouse-server/users.d/default-password.xml\n"