also adjust error messages when adding admins + fix phpunit tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -286,7 +286,9 @@ class Admins extends ApiCommand implements ResourceEntity
|
||||
Response::standardError('loginnameexists', $loginname, true);
|
||||
} elseif (preg_match('/^' . preg_quote(Settings::Get('customer.accountprefix'), '/') . '([0-9]+)/', $loginname)) {
|
||||
// Accounts which match systemaccounts are not allowed, filtering them
|
||||
Response::standardError('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
|
||||
Response::standardError('loginnameisusingprefix', Settings::Get('customer.accountprefix'), true);
|
||||
} elseif (function_exists('posix_getpwnam') && !in_array("posix_getpwnam", explode(",", ini_get('disable_functions'))) && posix_getpwnam($loginname)) {
|
||||
Response::standardError('loginnameissystemaccount', $loginname, true);
|
||||
} elseif (!Validate::validateUsername($loginname)) {
|
||||
Response::standardError('loginnameiswrong', $loginname, true);
|
||||
} elseif (!Validate::validateEmail($email)) {
|
||||
|
||||
@@ -429,7 +429,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
|
||||
// Additional filtering for Bug #962
|
||||
if (function_exists('posix_getpwnam') && !in_array("posix_getpwnam", explode(",", ini_get('disable_functions'))) && posix_getpwnam($loginname)) {
|
||||
Response::standardError('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
|
||||
Response::standardError('loginnameissystemaccount', $loginname, true);
|
||||
}
|
||||
} else {
|
||||
$accountnumber = intval(Settings::Get('system.lastaccountnumber')) + 1;
|
||||
|
||||
@@ -86,7 +86,7 @@ class AdminsTest extends TestCase
|
||||
'name' => 'Testreseller'
|
||||
];
|
||||
|
||||
$this->expectExceptionMessage('You cannot create accounts which are similar to system accounts (as for example begin with "web"). Please enter another account name.');
|
||||
$this->expectExceptionMessage('You cannot create accounts that begin with "web", as this prefix is set to be used for the automatic account-naming. Please enter another account name.');
|
||||
Admins::getLocal($admin_userdata, $data)->add();
|
||||
}
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ class CustomersTest extends TestCase
|
||||
)
|
||||
];
|
||||
|
||||
$this->expectExceptionMessage('You cannot create accounts which are similar to system accounts (as for example begin with "web"). Please enter another account name.');
|
||||
$this->expectExceptionMessage('You cannot create accounts that begin with "web", as this prefix is set to be used for the automatic account-naming. Please enter another account name.');
|
||||
Customers::getLocal($admin_userdata, $data)->add();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user