diff --git a/core/Api/UserAPI.class.php b/core/Api/UserAPI.class.php
index 01d99e2..8deb540 100644
--- a/core/Api/UserAPI.class.php
+++ b/core/Api/UserAPI.class.php
@@ -148,6 +148,9 @@ namespace Api\User {
return false;
}
+ // prevent duplicate keys
+ $email = (!is_null($email) && empty($email)) ? null : $email;
+
$id = $this->insertUser($username, $email, $password);
if ($this->success) {
$this->result["userId"] = $id;
@@ -605,6 +608,8 @@ If the registration was not intended, you can simply ignore this email.
<
$password = $this->getParam("password");
$groups = $this->getParam("groups");
+ $email = (!is_null($email) && empty($email)) ? null : $email;
+
$groupIds = array();
if (!is_null($groups)) {
$param = new Parameter('groupId', Parameter::TYPE_INT);