Skip to content

Commit

Permalink
Merge pull request #92 from WanpengQian/master
Browse files Browse the repository at this point in the history
Some adjustments
  • Loading branch information
Crivaledaz authored Aug 23, 2022
2 parents 8f1f233 + 2a77507 commit e7efc7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions oauth/LDAP/LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function checkLogin($user, $password = null, $ldap_search_attribute, $lda
*/
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');
Expand Down Expand Up @@ -212,7 +212,9 @@ public function getDataForMattermost($ldap_base_dn, $ldap_filter, $ldap_bind_dn,
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]);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion oauth/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function messageShow($html_template, $message = 'No Msg') {
{
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');
}
Expand Down
2 changes: 1 addition & 1 deletion oauth/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// 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" => "",
Expand Down
10 changes: 5 additions & 5 deletions oauth/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand All @@ -63,7 +63,7 @@ table {
justify-content: center;
align-items: center;
position: absolute;
transform: translate(-50%, 25%);
transform: translate(-50%, 8%);
}

/* Style input fields */
Expand All @@ -86,7 +86,7 @@ table {
height: 60px;

/* Make the borders more round */
border-radius: 12px;
border-radius: 5px;
width: 100%;
}

Expand Down Expand Up @@ -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%;
}
Expand Down

0 comments on commit e7efc7d

Please sign in to comment.