Merge pull request #316 from neopostmodern/ldap-provider-name

Allow displaying LDAP provider name on sign-in modal
This commit is contained in:
Max Wu 2017-01-09 23:17:55 +08:00 committed by GitHub
commit 258a59a77d
3 changed files with 7 additions and 2 deletions

View file

@ -148,6 +148,7 @@ Environment variables (will overwrite other server configs)
| HMD_LDAP_SEARCHFILTER | (uid={{username}}) | LDAP filter to search with | | HMD_LDAP_SEARCHFILTER | (uid={{username}}) | LDAP filter to search with |
| HMD_LDAP_SEARCHATTRIBUTES | no example | LDAP attributes 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_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_IMGUR_CLIENTID | no example | Imgur API client id |
| HMD_EMAIL | `true` or `false` | set to allow email register and signin | | 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) | | 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) |

View file

@ -102,7 +102,8 @@ var ldap = config.ldap || (
process.env.HMD_LDAP_TOKENSECRET || process.env.HMD_LDAP_TOKENSECRET ||
process.env.HMD_LDAP_SEARCHBASE || process.env.HMD_LDAP_SEARCHBASE ||
process.env.HMD_LDAP_SEARCHFILTER || process.env.HMD_LDAP_SEARCHFILTER ||
process.env.HMD_LDAP_SEARCHATTRIBUTES process.env.HMD_LDAP_SEARCHATTRIBUTES ||
process.env.HMD_LDAP_PROVIDERNAME
) || false; ) || false;
if (ldap == true) if (ldap == true)
ldap = {}; ldap = {};
@ -126,6 +127,9 @@ if (process.env.HMD_LDAP_TLS_CA) {
} }
ldap.tlsOptions = ldap.tlsOptions ? Object.assign(ldap.tlsOptions, ca) : 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 imgur = process.env.HMD_IMGUR_CLIENTID || config.imgur || false;
var email = process.env.HMD_EMAIL ? (process.env.HMD_EMAIL === 'true') : !!config.email; var email = process.env.HMD_EMAIL ? (process.env.HMD_EMAIL === 'true') : !!config.email;

View file

@ -42,7 +42,7 @@
<hr> <hr>
<% }%> <% }%>
<% if(ldap) { %> <% 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"> <form data-toggle="validator" role="form" class="form-horizontal" method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">