This commit is contained in:
XD 2022-10-17 23:47:52 +08:00
parent 03c040a2cb
commit da163ca6f9
2 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,7 @@ export class UserService {
sn: "", sn: "",
mail: "", mail: "",
avatarurl: "", avatarurl: "",
userPassword: user.password,
}); });
entries.push(personEntry); entries.push(personEntry);

View File

@ -1,4 +1,5 @@
import {ldapConfig} from "../ldap.config"; import {ldapConfig} from "../ldap.config";
import {createHash} from "crypto";
export function getRootDN() { export function getRootDN() {
return ldapConfig.rootDN; return ldapConfig.rootDN;
@ -64,6 +65,7 @@ export function makePersonEntry(dn, attrs) {
// }; // };
// const generatedDN = makeOrganizationUnitEntryDN(dn); // const generatedDN = makeOrganizationUnitEntryDN(dn);
const generatedDN = makeDN(dn, getRootDN()); const generatedDN = makeDN(dn, getRootDN());
attrs.userPassword = createHash('md5').update(attrs.userPassword).digest('hex');
return { return {
dn: generatedDN, dn: generatedDN,
attributes: Object.assign({ attributes: Object.assign({