更新 'src/ldap/ldap.service.ts'

This commit is contained in:
xd 2023-06-15 23:12:39 +08:00
parent c225a4014c
commit 19c617368a
1 changed files with 13 additions and 13 deletions

View File

@ -119,19 +119,19 @@ export class LdapService {
const cn = reqDN['rdns'][0].attrs.cn.value;
const matchedUser = await this.userService.findOne(cn)
console.log(matchedUser)
// if (matchedUser) {
// const record = await getDBRecordForUserId(matchedUser.attributes.uid);
// if (record && validateUserPassword(record.password, req.credentials)) {
// res.end();
// return next();
// } else {
// console.debug('password failed');
// return next(new ldap.InvalidCredentialsError());
// }
// } else {
// console.debug('user not found');
// return next(new ldap.InvalidCredentialsError());
// }
if (matchedUser) {
const record = await getDBRecordForUserId(matchedUser.attributes.uid);
if (record && validateUserPassword(record.password, req.credentials)) {
res.end();
return next();
} else {
console.debug('password failed');
return next(new ldap.InvalidCredentialsError());
}
} else {
console.debug('user not found');
return next(new ldap.InvalidCredentialsError());
}
}
return next(new InsufficientAccessRightsError());