diff --git a/include/CheckoutPage.php b/include/CheckoutPage.php index f72af55..797b047 100644 --- a/include/CheckoutPage.php +++ b/include/CheckoutPage.php @@ -45,13 +45,18 @@ class CheckoutPage extends Page { $search = $email .'@dsv.su.se'; } # Lookup email directly in ldap since we don't store it - $emailuser = new User($this->ldap->search_email($search), - 'name'); - } catch(Exception $ue) { + $uid = $this->ldap->search_email($search); + } catch(Exception $le) { $err = i18n('Email address {address} not found.', $search); throw new Exception($err); } + try { + $emailuser = new User($uid, 'name'); + } catch(Exception $ue) { + # User wasn't found locally, so initialize a new user + $emailuser = User::create_user($uid); + } } if($nameuser && $emailuser) { if($nameuser != $emailuser) {