Skip to content

Commit e49cfb4

Browse files
committed
Fixed validation on LDAP
1 parent db8ea88 commit e49cfb4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/controllers/admin/UsersController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,9 +1060,9 @@ public function getLDAP() {
10601060
protected $ldapValidationRules = array(
10611061
'firstname' => 'required|alpha_space|min:2',
10621062
'lastname' => 'required|alpha_space|min:2',
1063-
'employee_number' => 'required|numeric',
1063+
'employee_number' => 'numeric',
10641064
'username' => 'required|min:2|unique:users,username',
1065-
'email' => 'required|email|unique:users,email',
1065+
'email' => 'email|unique:users,email',
10661066
);
10671067

10681068
/**
@@ -1073,6 +1073,7 @@ public function getLDAP() {
10731073
*/
10741074
public function postLDAP() {
10751075

1076+
$ldap_version = Config::get('ldap.version');
10761077
$url = Config::get('ldap.url');
10771078
$username = Config::get('ldap.username');
10781079
$password = Config::get('ldap.password');
@@ -1094,7 +1095,7 @@ public function postLDAP() {
10941095
}
10951096

10961097
// Set options
1097-
$ldapopt = @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
1098+
$ldapopt = @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, $ldap_version);
10981099
if (!$ldapopt) {
10991100
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_connect'));
11001101
}
@@ -1106,7 +1107,7 @@ public function postLDAP() {
11061107
}
11071108

11081109
// Perform the search
1109-
$search_results = @ldap_search($ldapconn, $base_dn, $filter);
1110+
$search_results = @ldap_search($ldapconn, $base_dn, '('.$filter.')');
11101111
if (!$search_results) {
11111112
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
11121113
}

0 commit comments

Comments
 (0)