ENCOA-308
This commit is contained in:
@@ -38,7 +38,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
passport_id?: string;
|
||||
phone: string;
|
||||
};
|
||||
entity?: string
|
||||
entity: { id: string, label: string }
|
||||
entities: { id: string, role: string }[]
|
||||
passwordHash: string | undefined;
|
||||
passwordSalt: string | undefined;
|
||||
@@ -49,11 +49,10 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
const salt = crypto.randomBytes(16).toString('base64');
|
||||
const hash = await scrypt.hash(user.passport_id, salt);
|
||||
|
||||
const entity = await getEntityWithRoles(currentUser.entity!)
|
||||
const entity = await getEntityWithRoles(currentUser.entity!.id)
|
||||
const defaultRole = findBy(entity?.roles || [], "isDefault", true)
|
||||
|
||||
currentUser.entities = [{ id: entity?.id || "", role: defaultRole?.id || "" }]
|
||||
delete currentUser.entity
|
||||
|
||||
currentUser.email = currentUser.email.toLowerCase();
|
||||
currentUser.passwordHash = hash;
|
||||
|
||||
Reference in New Issue
Block a user