Skip to content

Commit

Permalink
Merge pull request #1074 from AletheiaFact/hotfix-user-creation
Browse files Browse the repository at this point in the history
Hotfix: Fixed User creation
  • Loading branch information
thesocialdev authored Oct 31, 2023
2 parents 2e2c40b + 820f571 commit 5d7e005
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion server/auth/ory/ory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class OryService {
url,
schema_id,
} = this.configService.get("ory");
return fetch(`${url}/${this.adminEndpoint}/identities`, {
const result = await fetch(`${url}/${this.adminEndpoint}/identities`, {
method: "post",
body: JSON.stringify({
schema_id,
Expand All @@ -113,6 +113,8 @@ export default class OryService {
Authorization: `Bearer ${token}`,
},
});

return await result.json();
}

deleteIdentity(identityId): Promise<any> {
Expand Down
4 changes: 2 additions & 2 deletions server/users/schemas/user.schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Status } from "../../auth/ability/ability.factory";
import { Roles, Status } from "../../auth/ability/ability.factory";
import { Document, Types } from "mongoose";
import { Badge } from "../../badge/schemas/badge.schema";

Expand All @@ -21,7 +21,7 @@ export class User {
@Prop({ required: true, default: false })
firstPasswordChanged: boolean;

@Prop({ type: Object, required: true })
@Prop({ type: Object, required: true, default: { main: Roles.Regular } })
role: object;

@Prop({ required: true, default: false })
Expand Down
2 changes: 1 addition & 1 deletion server/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class UsersService {
this.notificationService.createSubscriber(newUser);
if (!newUser.oryId) {
this.logger.log("No user id provided, creating a new ory identity");
const { data: oryUser } = await this.oryService.createIdentity(
const oryUser = await this.oryService.createIdentity(
newUser,
user.password,
user.role
Expand Down

0 comments on commit 5d7e005

Please sign in to comment.