MFB: Allow to update existing identities while requiring email confirmation (Sebastia...
authorJan Schneider <jan@horde.org>
Wed, 17 Mar 2010 17:23:43 +0000 (18:23 +0100)
committerJan Schneider <jan@horde.org>
Wed, 17 Mar 2010 17:25:50 +0000 (18:25 +0100)
framework/Prefs/lib/Horde/Prefs/Identity.php
horde/docs/CHANGES

index 98959a5..0e0c8c7 100644 (file)
@@ -484,13 +484,22 @@ class Horde_Prefs_Identity
         }
 
         $identity = $this->_prefs->convertFromDriver($confirm[$hash], Horde_Nls::getCharset());
-        $verified = array();
-        foreach ($identity as $key => $value) {
-            if (!$this->_prefs->isLocked($key)) {
-                $verified[$key] = $value;
+        $id = array_search($identity['id'], $this->getAll('id'));
+        if ($id === false) {
+            /* Adding a new identity. */
+            $verified = array();
+            foreach ($identity as $key => $value) {
+                if (!$this->_prefs->isLocked($key)) {
+                    $verified[$key] = $value;
+                }
+            }
+            $this->add($verified);
+        } else {
+            /* Updating an existing identity. */
+            foreach ($identity as $key => $value) {
+                $this->setValue($key, $value, $id);
             }
         }
-        $this->add($verified);
         $this->save();
         unset($confirm[$hash]);
         $this->_prefs->setValue('confirm_email', serialize($confirm), false);
index 23eae81..6ff3550 100644 (file)
@@ -37,6 +37,8 @@ v4.0-cvs
 v3.3.7-cvs
 ----------
 
+[jan] Allow to update existing identities while requiring email confirmation
+      (Sebastian Radish, Bug #8877).
 [jan] Fix casting errors when using SQL shares and groups on PostgreSQL
       (Bug #8899).
 [gwr] Allow conf.d style directory configuration overriding (Request #8172).