This commit is contained in:
Flatlogic Bot 2025-09-01 15:39:23 +00:00
parent d2cac44198
commit d36801edc4
2 changed files with 16 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -43,23 +43,30 @@ class Auth {
return helpers.jwtSign(data);
}
const newUser = await UsersDBApi.createFromAuth(
{
firstName: email.split('@')[0],
password: hashedPassword,
email: email,
},
options,
// Create new user with default role
const newUser = await UsersDBApi.create(
{ data: {
firstName: email.split('@')[0],
password: hashedPassword,
email: email,
}
}
);
// Send verification email if configured
if (EmailSender.isConfigured) {
await this.sendEmailAddressVerificationEmail(newUser.email, host);
}
// Fetch assigned role instance
const roleInstance = await newUser.getApp_role();
// Build JWT payload including role
const data = {
user: {
id: newUser.id,
email: newUser.email,
role: roleInstance ? roleInstance.name : null,
},
};