Compare commits

..

4 Commits

Author SHA1 Message Date
deployer3000 d66279885b Merge pull request 'rc' (#9) from rc into main 2025-03-26 15:42:36 +03:00
YurijO 8b494be023 Merge pull request 'CORS settings' (#8) from feature into rc
test-org/trust-module-backend/pipeline/pr-main Build succeeded
Reviewed-on: http://192.168.2.61/deployer3000/trust-module-backend/pulls/8
Reviewed-by: Vladislav Drozdov <ya2@ya.ru>
2025-03-26 15:38:53 +03:00
DmitriyA c02a6fdbe1 add OPTIONS
test-org/trust-module-backend/pipeline/pr-rc This commit looks good Details
2025-03-26 08:38:02 -04:00
DmitriyA b8b55951e8 CORS settings
test-org/trust-module-backend/pipeline/pr-rc This commit looks good Details
2025-03-26 07:55:39 -04:00
2 changed files with 4 additions and 6 deletions

View File

@ -11,21 +11,17 @@ export class AuthService {
) { }
async validateUser(login: string, password: string): Promise<any> {
console.log(`Проверка пользователя: ${login}, пароль: ${password}`);
// Ищем пользователя по login
const user = await this.usersRepository.findOne({ where: { login } });
console.log(`Найденный пользователь:`, user);
// Проверяем, что нашли пользователя и пароль совпадает
if (user && user.password === password) {
console.log(`Авторизация успешна`);
const { password, ...result } = user;
return result;
}
console.log(`Ошибка: неверный логин или пароль`);
return null;
}
}

View File

@ -5,9 +5,11 @@ import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
//настройка CORS
app.enableCors({
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
allowedHeaders: 'Content-Type, Authorization',
});
await app.listen(process.env.PORT ?? 3000);