Browse code

Ermögliche das Ändern von Passwörtern, wenn man als E-Mail-Account mit der Endung @[masterdomain] angemeldet ist.

schokokeks.org web services authored on11/04/2014 17:07:22
Showing1 changed files
... ...
@@ -160,8 +160,13 @@ function get_mailaccount_id($accountname)
160 160
                 ":domain" => $domain);
161 161
 
162 162
   $result = db_query("SELECT acc.id FROM mail.mailaccounts AS acc LEFT JOIN mail.v_domains AS dom ON (dom.id=acc.domain) WHERE local=:local AND dom.domainname=:domain", $args);
163
-  if ($result->rowCount() != 1)
163
+  if (($result->rowCount() == 0) && ($domain == config('masterdomain'))) {
164
+    unset($args[':domain']);
165
+    $result = db_query("SELECT acc.id FROM mail.mailaccounts AS acc WHERE local=:local AND acc.domain IS NULL", $args);
166
+  }
167
+  if ($result->rowCount() != 1) {
164 168
     system_failure('account nicht eindeutig');
169
+  }    
165 170
   $acc = $result->fetch();
166 171
   return $acc['id'];
167 172
 }