Changed checkoutPage email search behaviour
Now a default domain is appended on email string that don't contain an @ character
This commit is contained in:
parent
cb4a3b131a
commit
4fbffa1402
@ -25,12 +25,12 @@ class CheckoutPage extends Page {
|
|||||||
$emailuser = null;
|
$emailuser = null;
|
||||||
if($name) {
|
if($name) {
|
||||||
try {
|
try {
|
||||||
$nameuser = new User($this->userstr, 'name');
|
$nameuser = new User($name, 'name');
|
||||||
} catch(Exception $ue) {
|
} catch(Exception $ue) {
|
||||||
# The user wasn't found locally
|
# The user wasn't found locally
|
||||||
try {
|
try {
|
||||||
$this->ldap->get_user($this->userstr);
|
$this->ldap->get_user($name);
|
||||||
$nameuser = User::create_user($this->userstr);
|
$nameuser = User::create_user($name);
|
||||||
} catch(Exception $le) {
|
} catch(Exception $le) {
|
||||||
$err = "Användarnamnet '$name' kunde inte hittas.";
|
$err = "Användarnamnet '$name' kunde inte hittas.";
|
||||||
throw new Exception($err);
|
throw new Exception($err);
|
||||||
@ -39,11 +39,15 @@ class CheckoutPage extends Page {
|
|||||||
}
|
}
|
||||||
if($email) {
|
if($email) {
|
||||||
try {
|
try {
|
||||||
|
$search = $email;
|
||||||
|
if(strpos($email, '@') === false) {
|
||||||
|
$search = $email .'@dsv.su.se';
|
||||||
|
}
|
||||||
# Lookup email directly in ldap since we don't store it
|
# Lookup email directly in ldap since we don't store it
|
||||||
$emailuser = new User($this->ldap->search_email($email),
|
$emailuser = new User($this->ldap->search_email($search),
|
||||||
'name');
|
'name');
|
||||||
} catch(Exception $ue) {
|
} catch(Exception $ue) {
|
||||||
$err = "E-postadressen '$emailuser' kunde inte hittas.";
|
$err = "E-postadressen '$search' kunde inte hittas.";
|
||||||
throw new Exception($err);
|
throw new Exception($err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,8 +65,8 @@ class CheckoutPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function render_body() {
|
protected function render_body() {
|
||||||
$username = '';
|
$username = $this->userstr;
|
||||||
$email = '';
|
$email = $this->emailstr;
|
||||||
$displayname = '';
|
$displayname = '';
|
||||||
$notes = '';
|
$notes = '';
|
||||||
$loan_table = '';
|
$loan_table = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user