Merge pull request #477 from friendica/revert-475-task/4041-fix-register

Revert "Use Exceptions for User::create"
This commit is contained in:
Tobias Diekershoff 2017-12-13 12:13:17 +01:00 committed by GitHub
commit 28603f86e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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