Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

using Public where needed

Blue Mouse2738d176059c
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.ts
index 3742520b9..5399eb305 100644
--- a/src/analytics/analytics.controller.ts
+++ b/src/analytics/analytics.controller.ts
@@ -66,6 +66,7 @@ import {
import { BotDetection } from '../common/decorators/bot-detection.decorator'
import { BotDetectionGuard } from '../common/guards/bot-detection.guard'
import { JwtAccessTokenGuard } from 'src/auth/guards'
+import { Public } from 'src/auth/decorators'
dayjs.extend(utc)
dayjs.extend(timezone)
@@ -202,6 +203,7 @@ const TRANSPARENT_GIF_BUFFER = Buffer.from(
@ApiTags('Analytics')
@UseGuards(JwtAccessTokenGuard, RolesGuard)
+@Public()
@Controller('log')
export class AnalyticsController {
constructor(
diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts
index 67e1a661d..1c312c2ad 100644
--- a/src/auth/auth.controller.ts
+++ b/src/auth/auth.controller.ts
@@ -22,6 +22,8 @@ import {
ApiOkResponse,
} from '@nestjs/swagger'
import { I18nValidationExceptionFilter, I18n, I18nContext } from 'nestjs-i18n'
+import * as _pick from 'lodash/pick'
+
import { checkRateLimit } from 'src/common/utils'
import { UserType } from 'src/user/entities/user.entity'
import { UserService } from 'src/user/user.service'
@@ -124,7 +126,7 @@ export class AuthController {
await checkRateLimit(ip, 'login', 10, 1800)
- const user = await this.authService.validateUser(body.email, body.password)
+ let user = await this.authService.validateUser(body.email, body.password)
if (!user) {
throw new ConflictException(i18n.t('auth.invalidCredentials'))
@@ -134,10 +136,14 @@ export class AuthController {
const jwtTokens = await this.authService.generateJwtTokens(user.id)
+ if (user.isTwoFactorAuthenticationEnabled) {
+ user = _pick(user, ['isTwoFactorAuthenticationEnabled', 'email'])
+ }
+
return {
accessToken: jwtTokens.accessToken,
refreshToken: jwtTokens.refreshToken,
- isTwoFactorAuthenticationEnabled: user.isTwoFactorAuthenticationEnabled,
+ user,
}
}
diff --git a/src/auth/dtos/login.dto.ts b/src/auth/dtos/login.dto.ts
index ca49e09fe..ff3b0d7f8 100644
--- a/src/auth/dtos/login.dto.ts
+++ b/src/auth/dtos/login.dto.ts
@@ -12,10 +12,10 @@ export class LoginRequestDto extends OmitType(RegisterRequestDto, [
class AdditionalInfo {
@ApiProperty({
- description: 'Is two factor authentication enabled',
+ description: 'User entity',
example: false,
})
- isTwoFactorAuthenticationEnabled: boolean
+ user: object
}
export class LoginResponseDto extends IntersectionType(
diff --git a/src/project/project.controller.ts b/src/project/project.controller.ts
index d607ec763..1ea63b742 100644
--- a/src/project/project.controller.ts
+++ b/src/project/project.controller.ts
@@ -56,6 +56,7 @@ import {
deleteProjectClickhouse,
} from '../common/utils'
import { JwtAccessTokenGuard } from 'src/auth/guards'
+import { Public } from 'src/auth/decorators'
// const updateProjectRedis = async (id: string, project: Project) => {
// const key = getRedisProjectKey(id)
@@ -226,6 +227,7 @@ export class ProjectController {
}
@Get('/:id')
+ @Public()
@ApiResponse({ status: 200, type: Project })
async getOne(
@Param('id') id: string,
@@ -776,6 +778,7 @@ export class ProjectController {
@UseGuards(SelfhostedGuard)
// @UseGuards(JwtAccessTokenGuard, RolesGuard)
// @Roles(UserType.CUSTOMER, UserType.ADMIN)
+ @Public()
@ApiResponse({ status: 204, description: 'Empty body' })
@Get('/share/:id')
async acceptShare(@Param('id') id: string): Promise<any> {