diff --git a/sites/backend/src/models/apikey.mjs b/sites/backend/src/models/apikey.mjs index 4848a7e3b6d..d3c29ba45a7 100644 --- a/sites/backend/src/models/apikey.mjs +++ b/sites/backend/src/models/apikey.mjs @@ -63,6 +63,7 @@ ApikeyModel.prototype.guardedRead = async function ({ params, user }) { apikey: { key: this.record.id, level: this.record.level, + createdAt: this.record.createdAt, expiresAt: this.record.expiresAt, name: this.record.name, userId: this.record.userId, @@ -141,6 +142,7 @@ ApikeyModel.prototype.create = async function ({ body, user }) { key: this.record.id, secret, level: this.record.level, + createdAt: this.record.createdAt, expiresAt: this.record.expiresAt, name: this.record.name, userId: this.record.userId, diff --git a/sites/backend/src/models/pattern.mjs b/sites/backend/src/models/pattern.mjs index 66ea00a1abc..0deb5554e82 100644 --- a/sites/backend/src/models/pattern.mjs +++ b/sites/backend/src/models/pattern.mjs @@ -11,22 +11,6 @@ export function PatternModel(tools) { return this } -/* - id Int @id @default(autoincrement()) - createdAt DateTime @default(now()) - data String - design String - img String? - person Person? @relation(fields: [personId], references: [id]) - personId Int? - name String @default("") - notes String - public - settings String - user User @relation(fields: [userId], references: [id]) - userId Int - updatedAt DateTime @updatedAt - */ PatternModel.prototype.guardedCreate = async function ({ body, user }) { if (user.level < 3) return this.setResponse(403, 'insufficientAccessLevel') diff --git a/sites/backend/src/models/user.mjs b/sites/backend/src/models/user.mjs index 6f09a81ac2c..40d49ae2ee9 100644 --- a/sites/backend/src/models/user.mjs +++ b/sites/backend/src/models/user.mjs @@ -265,7 +265,7 @@ UserModel.prototype.passwordLogin = async function (req) { * Confirms a user account */ UserModel.prototype.confirm = async function ({ body, params }) { - if (!params.id) return this.setResponse(404, 'missingConfirmationId') + if (!params.id) return this.setResponse(404, 'confirmationIdMissing') if (Object.keys(body) < 1) return this.setResponse(400, 'postBodyMissing') if (!body.consent || typeof body.consent !== 'number' || body.consent < 1) return this.setResponse(400, 'consentRequired') @@ -338,7 +338,7 @@ UserModel.prototype.guardedUpdate = async function ({ body, user }) { if (typeof body.bio === 'string') data.bio = body.bio // Consent if ([0, 1, 2, 3].includes(body.consent)) data.consent = body.consent - // Consent + // Control if ([1, 2, 3, 4, 5].includes(body.control)) data.control = body.control // Github if (typeof body.github === 'string') data.github = body.github.split('@').pop() @@ -442,8 +442,8 @@ UserModel.prototype.guardedMfaUpdate = async function ({ body, user, ip }) { // Disable if (body.mfa === false) { - if (!body.token) return this.setResponse(400, 'mfaTokenRequired') - if (!body.password) return this.setResponse(400, 'passwordRequired') + if (!body.token) return this.setResponse(400, 'mfaTokenMissing') + if (!body.password) return this.setResponse(400, 'passwordMissing') // Check password const [valid] = verifyPassword(body.password, this.record.password) if (!valid) {