diff --git a/.gitignore b/.gitignore index 7c4f045..823440e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ error_log *.swo .htaccess payex_defines.php +.idea \ No newline at end of file diff --git a/inside/User.php b/inside/User.php index ca8a454..d115ea8 100644 --- a/inside/User.php +++ b/inside/User.php @@ -188,7 +188,7 @@ class User { $sql = sprintf("INSERT INTO din_user " . " (id, username, password, firstname, " . " lastname, addresstype, email, birthdate, " . - " placeOfStudy, division_id_request, ldap_username) " . "VALUES " . " (%s, %s, PASSWORD(%s), %s, %s, %s, %s, " . " %s, %s, %s, %s)", $this->conn->quoteSmart($this->id), $this->conn->quoteSmart($this->username), $this->conn->quoteSmart($this->password), $this->conn->quoteSmart($this->firstname), $this->conn->quoteSmart($this->lastname), $this->conn->quoteSmart($this->addresstype), $this->conn->quoteSmart($this->email), $this->conn->quoteSmart($this->birthdate), $this->conn->quoteSmart($this->placeOfStudy), $this->conn->quoteSmart(($this->division_id_request == NULL) ? NULL : $this->division_id_request), $this->conn->quoteSmart($this->username)); + " placeOfStudy, division_id_request, ldap_username, ldap_password) " . "VALUES " . " (%s, %s, PASSWORD(%s), %s, %s, %s, %s, " . " %s, %s, %s, %s, %s)", $this->conn->quoteSmart($this->id), $this->conn->quoteSmart($this->username), $this->conn->quoteSmart($this->password), $this->conn->quoteSmart($this->firstname), $this->conn->quoteSmart($this->lastname), $this->conn->quoteSmart($this->addresstype), $this->conn->quoteSmart($this->email), $this->conn->quoteSmart($this->birthdate), $this->conn->quoteSmart($this->placeOfStudy), $this->conn->quoteSmart(($this->division_id_request == NULL) ? NULL : $this->division_id_request), $this->conn->quoteSmart($this->username), $this->conn->quoteSmart(hash_ldap_password($this->password))); $result = $this->conn->query($sql); if (DB :: isError($result) == true) { if ($result->getCode() == -5) { diff --git a/inside/functions.php b/inside/functions.php index e42b29a..8559c96 100644 --- a/inside/functions.php +++ b/inside/functions.php @@ -1780,4 +1780,10 @@ function log_userupdate($updated, $comment, $updated_by=NULL) { return true; } +function hash_ldap_password($raw_password) { + $salt = openssl_random_pseudo_bytes(4); + + return '{SSHA}' . base64_encode(sha1( $raw_password.$salt, TRUE ). $salt); +} + ?>