summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneopostmodern2017-01-09 12:49:23 +0100
committerneopostmodern2017-01-09 12:49:23 +0100
commitff545b268871be7b6552638427a59a9a6eac5dd1 (patch)
tree3324acedf1e0d70ee82c40381e04ef097a0d50a7
parentb13635aac9d42996d0ac9b9b7dcbdf94102c7abe (diff)
Allow displaying LDAP provider name on sign-in modal
Diffstat (limited to '')
-rw-r--r--README.md1
-rw-r--r--lib/config.js6
-rw-r--r--public/views/signin-modal.ejs2
3 files changed, 7 insertions, 2 deletions
diff --git a/README.md b/README.md
index 7040aeb3..4717ca7c 100644
--- a/README.md
+++ b/README.md
@@ -148,6 +148,7 @@ Environment variables (will overwrite other server configs)
| HMD_LDAP_SEARCHFILTER | (uid={{username}}) | LDAP filter to search with |
| HMD_LDAP_SEARCHATTRIBUTES | no example | LDAP attributes to search with |
| HMD_LDAP_TLS_CA | no example | Root CA for LDAP TLS in PEM format |
+| HMD_LDAP_PROVIDERNAME | My institution | Optional name to be displayed at login form indicating the LDAP provider |
| HMD_IMGUR_CLIENTID | no example | Imgur API client id |
| HMD_EMAIL | `true` or `false` | set to allow email register and signin |
| 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) |
diff --git a/lib/config.js b/lib/config.js
index 2f6792b7..6b2ba0b6 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -102,7 +102,8 @@ var ldap = config.ldap || (
process.env.HMD_LDAP_TOKENSECRET ||
process.env.HMD_LDAP_SEARCHBASE ||
process.env.HMD_LDAP_SEARCHFILTER ||
- process.env.HMD_LDAP_SEARCHATTRIBUTES
+ process.env.HMD_LDAP_SEARCHATTRIBUTES ||
+ process.env.HMD_LDAP_PROVIDERNAME
) || false;
if (ldap == true)
ldap = {};
@@ -126,6 +127,9 @@ if (process.env.HMD_LDAP_TLS_CA) {
}
ldap.tlsOptions = ldap.tlsOptions ? Object.assign(ldap.tlsOptions, ca) : ca
}
+if (process.env.HMD_LDAP_PROVIDERNAME) {
+ ldap.providerName = process.env.HMD_LDAP_PROVIDERNAME;
+}
var imgur = process.env.HMD_IMGUR_CLIENTID || config.imgur || false;
var email = process.env.HMD_EMAIL ? (process.env.HMD_EMAIL === 'true') : !!config.email;
diff --git a/public/views/signin-modal.ejs b/public/views/signin-modal.ejs
index 7c52e0f3..e9c54b33 100644
--- a/public/views/signin-modal.ejs
+++ b/public/views/signin-modal.ejs
@@ -42,7 +42,7 @@
<hr>
<% }%>
<% if(ldap) { %>
- <h4>Via LDAP</h4>
+ <h4>Via <% if (ldap.providerName) { %> <%- ldap.providerName %> (LDAP) <% } else { %> LDAP <% } %></h4>
<form data-toggle="validator" role="form" class="form-horizontal" method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<div class="col-sm-12">