Skip to content

Commit 258a59a

Browse files
authored
Merge pull request #316 from neopostmodern/ldap-provider-name
Allow displaying LDAP provider name on sign-in modal
2 parents b13635a + ff545b2 commit 258a59a

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Environment variables (will overwrite other server configs)
148148
| HMD_LDAP_SEARCHFILTER | (uid={{username}}) | LDAP filter to search with |
149149
| HMD_LDAP_SEARCHATTRIBUTES | no example | LDAP attributes to search with |
150150
| HMD_LDAP_TLS_CA | no example | Root CA for LDAP TLS in PEM format |
151+
| HMD_LDAP_PROVIDERNAME | My institution | Optional name to be displayed at login form indicating the LDAP provider |
151152
| HMD_IMGUR_CLIENTID | no example | Imgur API client id |
152153
| HMD_EMAIL | `true` or `false` | set to allow email register and signin |
153154
| HMD_IMAGE_UPLOAD_TYPE | `imgur`, `s3` or `filesystem` | Where to upload image. For S3, see our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |

lib/config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ var ldap = config.ldap || (
102102
process.env.HMD_LDAP_TOKENSECRET ||
103103
process.env.HMD_LDAP_SEARCHBASE ||
104104
process.env.HMD_LDAP_SEARCHFILTER ||
105-
process.env.HMD_LDAP_SEARCHATTRIBUTES
105+
process.env.HMD_LDAP_SEARCHATTRIBUTES ||
106+
process.env.HMD_LDAP_PROVIDERNAME
106107
) || false;
107108
if (ldap == true)
108109
ldap = {};
@@ -126,6 +127,9 @@ if (process.env.HMD_LDAP_TLS_CA) {
126127
}
127128
ldap.tlsOptions = ldap.tlsOptions ? Object.assign(ldap.tlsOptions, ca) : ca
128129
}
130+
if (process.env.HMD_LDAP_PROVIDERNAME) {
131+
ldap.providerName = process.env.HMD_LDAP_PROVIDERNAME;
132+
}
129133
var imgur = process.env.HMD_IMGUR_CLIENTID || config.imgur || false;
130134
var email = process.env.HMD_EMAIL ? (process.env.HMD_EMAIL === 'true') : !!config.email;
131135

public/views/signin-modal.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<hr>
4343
<% }%>
4444
<% if(ldap) { %>
45-
<h4>Via LDAP</h4>
45+
<h4>Via <% if (ldap.providerName) { %> <%- ldap.providerName %> (LDAP) <% } else { %> LDAP <% } %></h4>
4646
<form data-toggle="validator" role="form" class="form-horizontal" method="post" enctype="application/x-www-form-urlencoded">
4747
<div class="form-group">
4848
<div class="col-sm-12">

0 commit comments

Comments
 (0)