Merge pull request #490 from coollabsio/next

v3.1.2
This commit is contained in:
Andras Bacsai 2022-07-14 10:52:34 +02:00 committed by GitHub
commit 039350d762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View File

@ -16,7 +16,7 @@ import { day } from './dayjs';
import * as serviceFields from './serviceFields' import * as serviceFields from './serviceFields'
import axios from 'axios'; import axios from 'axios';
export const version = '3.1.1'; export const version = '3.1.2';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr'; const algorithm = 'aes-256-ctr';

View File

@ -267,7 +267,8 @@ export async function saveApplicationSettings(request: FastifyRequest<SaveApplic
const { debug, previews, dualCerts, autodeploy, branch, projectId } = request.body const { debug, previews, dualCerts, autodeploy, branch, projectId } = request.body
const isDouble = await checkDoubleBranch(branch, projectId); const isDouble = await checkDoubleBranch(branch, projectId);
if (isDouble && autodeploy) { if (isDouble && autodeploy) {
throw { status: 500, message: 'Application not configured.' } await prisma.applicationSettings.updateMany({ where: { application: { branch, projectId } }, data: { autodeploy: false } })
throw { status: 500, message: 'Cannot activate automatic deployments until only one application is defined for this repository / branch.' }
} }
await prisma.application.update({ await prisma.application.update({
where: { id }, where: { id },
@ -526,6 +527,10 @@ export async function saveRepository(request, reply) {
data: { repository, branch, projectId, settings: { update: { autodeploy } } } data: { repository, branch, projectId, settings: { update: { autodeploy } } }
}); });
} }
const isDouble = await checkDoubleBranch(branch, projectId);
if (isDouble) {
await prisma.applicationSettings.updateMany({ where: { application: { branch, projectId } }, data: { autodeploy: false } })
}
return reply.code(201).send() return reply.code(201).send()
} catch ({ status, message }) { } catch ({ status, message }) {
return errorHandler({ status, message }) return errorHandler({ status, message })

View File

@ -157,10 +157,18 @@ export async function login(request: FastifyRequest<Login>, reply: FastifyReply)
if (userFound.password === 'RESETME') { if (userFound.password === 'RESETME') {
const hashedPassword = await hashPassword(password); const hashedPassword = await hashPassword(password);
if (userFound.updatedAt < new Date(Date.now() - 1000 * 60 * 10)) { if (userFound.updatedAt < new Date(Date.now() - 1000 * 60 * 10)) {
if (userFound.id === '0') {
await prisma.user.update({
where: { email: userFound.email },
data: { password: 'RESETME' }
});
} else {
await prisma.user.update({ await prisma.user.update({
where: { email: userFound.email }, where: { email: userFound.email },
data: { password: 'RESETTIMEOUT' } data: { password: 'RESETTIMEOUT' }
}); });
}
throw { throw {
status: 500, status: 500,
message: 'Password reset link has expired. Please request a new one.' message: 'Password reset link has expired. Please request a new one.'

View File

@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.1.1", "version": "3.1.2",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"db:studio": "pnpm run --filter coolify-api db:studio", "db:studio": "pnpm run --filter coolify-api db:studio",