Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

4 changed files with 11 additions and 24 deletions

5
.gitignore vendored
View File

@ -1,8 +1,3 @@
node_modules/ node_modules/
*/node_modules/ */node_modules/
*/build/ */build/
**/node_modules/
**/build/
.DS_Store
.env

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1 +0,0 @@
{}