Skip to content

Commit

Permalink
feat(authentication): add user to default team when creating through …
Browse files Browse the repository at this point in the history
…gRPC
  • Loading branch information
kkopanidis committed Apr 19, 2024
1 parent 49fba37 commit ae7962d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions modules/authentication/src/Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import { AuthUtils } from './utils/index.js';
import { TokenType } from './constants/index.js';
import { v4 as uuid } from 'uuid';
import {
CreateTeamRequest,
GetTeamRequest,
ModifyTeamMembersRequest,
Team as GrpcTeam,
TeamDeleteRequest,
TeamDeleteResponse,
UserChangePass,
Expand All @@ -24,10 +28,6 @@ import {
UserDeleteResponse,
UserLoginRequest,
UserLoginResponse,
GetTeamRequest,
CreateTeamRequest,
Team as GrpcTeam,
ModifyTeamMembersRequest,
ValidateAccessTokenRequest,
ValidateAccessTokenResponse,
ValidateAccessTokenResponse_Status,
Expand All @@ -47,6 +47,8 @@ import { TeamsAdmin } from './admin/team.js';
import { User as UserAuthz } from './authz/index.js';
import { handleAuthentication } from './routes/middleware.js';
import { fileURLToPath } from 'node:url';
import { TeamsHandler } from './handlers/team.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand Down Expand Up @@ -294,6 +296,11 @@ export default class Authentication extends ManagedModule<Config> {
'Failed to send verification email.' + ' Email service not online!',
);
}
await TeamsHandler.getInstance()
.addUserToDefault(user)
.catch(err => {
ConduitGrpcSdk.Logger.error(err);
});
return callback(null, { password });
} catch (e) {
return callback({ code: status.INTERNAL, message: (e as Error).message });
Expand Down

0 comments on commit ae7962d

Please sign in to comment.