diff --git a/account.inc.php b/account.inc.php
index 92344c2..d61f98f 100644
--- a/account.inc.php
+++ b/account.inc.php
@@ -133,24 +133,27 @@ function account_load_by_username($username)
function account_create($username,$password=NULL)
{
global $config;
+ $errMsg = '';
/* Sanity check username */
if(!account_valid_user($username)) {
- return i18n("Invalid user name \"%1\"", array($username));
- }
-
- /* Make sure the user doesn't exist */
- $us = mysql_real_escape_string($username);
- $q = mysql_query("SELECT * FROM accounts WHERE username='$us'");
- if(mysql_num_rows($q)) {
- return i18n("The username %1 is already in use", array($username));
+ $errMsg .= i18n('Invalid user name "%1"', array($username)) . " ";
+ }else{
+ /* Make sure the user doesn't exist */
+ $us = mysql_real_escape_string($username);
+ $q = mysql_query("SELECT * FROM accounts WHERE username='$us'");
+ if(mysql_num_rows($q)) {
+ $errMsg .= i18n("The username %1 is already in use", array($username)) . " ";
+ }
}
//if the password is set, make sure its valid, if its null, thats OK, it'll get generated and set by account_set_password
if($password && !account_valid_password($password)) {
- return i18n("Invalid password");
+ $errMsg .= i18n("Invalid password") . " ";
}
+ if($errMsg != '') return $errMsg;
+
/* Create the account */
mysql_query("INSERT INTO accounts (`username`,`created`,`deleted`,`superuser`)
VALUES ('$us', NOW(),'no','no')");
diff --git a/testapi.php b/testapi.php
index 65e025c..7a52636 100644
--- a/testapi.php
+++ b/testapi.php
@@ -98,6 +98,14 @@ email:
Link username to email? Yes No
+
Create an account:
+