update
This commit is contained in:
parent
b41a944c62
commit
b75dbf3e7f
|
@ -1,5 +1,6 @@
|
|||
import {ldapConfig} from "../ldap.config";
|
||||
import {createHash} from "crypto";
|
||||
import {createHash, randomUUID} from "crypto";
|
||||
import {randomStringGenerator} from "@nestjs/common/utils/random-string-generator.util";
|
||||
|
||||
export function getRootDN() {
|
||||
return ldapConfig.rootDN;
|
||||
|
@ -65,6 +66,9 @@ export function makePersonEntry(dn, attrs) {
|
|||
// };
|
||||
// const generatedDN = makeOrganizationUnitEntryDN(dn);
|
||||
const generatedDN = makeDN(dn, getRootDN());
|
||||
if (attrs.userPassword===''){
|
||||
attrs.userPassword = randomUUID();
|
||||
}
|
||||
const shaPassword = createHash('sha1').update(attrs.userPassword);
|
||||
const base64ShaPassword = shaPassword.digest('base64');
|
||||
attrs.userPassword = '{SHA}' + base64ShaPassword;
|
||||
|
|
Loading…
Reference in New Issue