fix(xo-server/authentication): fail fast with empty passwords

There is no reason to attempt authentication with empty passwords, and this work around issues with some LDAP servers which may allow binds with empty passwords.

See xoa-support#469.
This commit is contained in:
Julien Fontanet 2018-02-16 11:47:01 +01:00
parent 443882f4be
commit 8689b48c55

View File

@ -111,6 +111,12 @@ export default class {
}
async authenticateUser (credentials) {
// don't even attempt to authenticate with empty password
const { password } = credentials
if (password === '') {
throw new Error('empty password')
}
// TODO: remove when email has been replaced by username.
if (credentials.email) {
credentials.username = credentials.email