]> git.mxchange.org Git - friendica-addons.git/commitdiff
Revert "Revert "Use Exceptions for User::create""
authorMichael Vogel <icarus@dabo.de>
Wed, 13 Dec 2017 19:01:25 +0000 (20:01 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Dec 2017 19:01:25 +0000 (20:01 +0100)
ldapauth/ldapauth.php

index a0b270e38842adbc1cae6322bf7efe82c12ee230..63ccbe91598790d57f986ecfc6bdf771934456d2 100644 (file)
@@ -177,11 +177,12 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $
                if (empty($results)) {
                        if (strlen($email) > 0 && strlen($name) > 0) {
                                $arr = array('username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1);
-                               $result = User::create($arr);
-                               if ($result['success']) {
+
+                               try {
+                                       User::create($arr);
                                        logger("ldapauth: account " . $username . " created");
-                               } else {
-                                       logger("ldapauth: account " . $username . " was not created ! : " . implode($result));
+                               } catch (Exception $ex) {
+                                       logger("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage());
                                }
                        } else {
                                logger("ldapauth: unable to create account, no email or nickname found");