Skip to content

Commit

Permalink
Update LoginForm.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffry304 authored Nov 30, 2018
1 parent d911b65 commit d4d15a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion forms/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ public function createNewUser() {
$user = $this->module->model("User");
$profile = $this->module->model("Profile");

$result = \Yii::$app->ad->getDefaultProvider()->search()->select(["name", "mail", "samaccountname", "givenname", "sn"])->where('samaccountname', '=', $this->email)->get();
try {
$result = \Yii::$app->ad->getDefaultProvider()->search()->select(["name", "mail", "samaccountname", "givenname", "sn"])->where('samaccountname', '=', $this->email)->get();
} catch (\Adldap\Auth\BindException $ex) {
echo $ex->getMessage();
}
if (!empty($result[0])) {
if (isset($result[0]['attributes']['mail'])) {
$user->email = $result[0]['attributes']['mail'][0];
Expand Down

0 comments on commit d4d15a9

Please sign in to comment.