diff --git a/oauth/LDAP/LDAP.php b/oauth/LDAP/LDAP.php index 8b7de1c..3d13cfe 100755 --- a/oauth/LDAP/LDAP.php +++ b/oauth/LDAP/LDAP.php @@ -154,7 +154,7 @@ class LDAP implements LDAPInterface */ public function getDataForMattermost($ldap_base_dn, $ldap_filter, $ldap_bind_dn, $ldap_bind_pass, $ldap_search_attribute, $user) { - $attribute=array("cn","mail"); + $attribute=array("cn","mail","displayName"); if (!is_string($ldap_base_dn)) { throw new InvalidArgumentException('First argument to LDAP/getData must be the ldap base directory name (string). Ex: o=Company'); @@ -212,7 +212,9 @@ class LDAP implements LDAPInterface throw new Exception('An error has occured during ldap_get_values execution (complete name). Please check parameter of LDAP/getData.'); } - return array("mail" => $mail[0], "cn" => $cn[0]); + $displayName = ldap_get_values($this->ldap_server, $data, "displayName"); + + return array("mail" => $mail[0], "cn" => $cn[0], "displayName" => $displayName[0]); } /* diff --git a/oauth/index.php b/oauth/index.php index a0b4fd3..9a7e804 100644 --- a/oauth/index.php +++ b/oauth/index.php @@ -41,7 +41,7 @@ else { messageShow($prompt_template, 'Username has incorrect format ... Please try again'); } - elseif (strlen($_POST['password']) > 64 || strlen($_POST['password']) <= 7) + elseif (strlen($_POST['password']) > 64) { messageShow($prompt_template, 'Password has incorrect format ... Please try again'); } diff --git a/oauth/resource.php b/oauth/resource.php index b378dd4..f2739b4 100755 --- a/oauth/resource.php +++ b/oauth/resource.php @@ -36,7 +36,7 @@ try { // Here is the patch for Mattermost 4.4 and newer. Gitlab has changed the JSON output of oauth service. Many data are not used by Mattermost, but there is a stack error if we delete them. That's the reason why date and many parameters are null or empty. $resp = array( "id" => $assoc_id, - "name" => $data['cn'], + "name" => strlen($data['displayName']) > 0 ? $data['displayName'] : $data['cn'], "username" => $user, "state" => "active", "avatar_url" => "", diff --git a/oauth/style.css b/oauth/style.css index 5f1f1d9..2ba5037 100644 --- a/oauth/style.css +++ b/oauth/style.css @@ -47,12 +47,12 @@ table { #form_icon img { width: 100%; - max-width: 450px; + max-width: 150px; } #form_icon_prompt img { width: 50%; - max-width: 350px; + max-width: 150px; } @@ -63,7 +63,7 @@ table { justify-content: center; align-items: center; position: absolute; - transform: translate(-50%, 25%); + transform: translate(-50%, 8%); } /* Style input fields */ @@ -86,7 +86,7 @@ table { height: 60px; /* Make the borders more round */ - border-radius: 12px; + border-radius: 5px; width: 100%; } @@ -118,7 +118,7 @@ table { text-transform: capitalize; text-align: center; display: inline-block; - margin-top: 25%; + margin-top: 10%; margin-right: 2%; width: 50%; }