Reworked email lookup logic on CheckoutPage,

so a user will be automatically created if their email address exists in sukat but doesn't have a corresponding boka user yet.
This commit is contained in:
Erik Thuning 2024-02-27 15:49:52 +01:00
parent b2ff35a6d9
commit bf696127a9

@ -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) {