From 950527804ac03b9a671c668ef2989fb82ff36b11 Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Tue, 23 Jun 2020 21:18:45 +0200 Subject: [PATCH] Prevent duplicate keys --- core/Api/UserAPI.class.php | 5 +++++ 1 file changed, 5 insertions(+) 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);