feat: полный бэк и фронт (попытки, разбор, импорт, ИИ, назначения)
- Сервисы: testAttemptService, testAccess, document import/gen/extract, LLM, assignment, aiEditor - Конфиг: devAuthor, featureFlags; messages/ru; интеграция V.9 (skip без БД) - API/роуты: app, auth, server; Dockerfile и env example - Фронт: TestAttempt, TestAttemptReview, AttemptReviewBlock, стили, правки App/api/login/vite - compose и README; смоук-тесты расширены Закрывает отсутствие модулей в origin после клона. Made-with: Cursor
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Password hashing and JWT token management
|
||||
*/
|
||||
|
||||
import bcrypt from 'bcrypt';
|
||||
import { hash, compare } from 'bcryptjs';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import dotenv from 'dotenv';
|
||||
import { checkWerkzeugPassword } from './werkzeugPassword.js';
|
||||
@@ -14,7 +14,7 @@ dotenv.config();
|
||||
const JWT_SECRET = process.env.JWT_SECRET;
|
||||
const JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || '7d';
|
||||
|
||||
// Salt rounds for bcrypt
|
||||
// Salt rounds (bcryptjs — тот же формат $2*, без нативной сборки — проще Docker/ARM/musl)
|
||||
const SALT_ROUNDS = 10;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ const SALT_ROUNDS = 10;
|
||||
* @returns {Promise<string>} Hashed password
|
||||
*/
|
||||
export async function hashPassword(password) {
|
||||
return bcrypt.hash(password, SALT_ROUNDS);
|
||||
return hash(password, SALT_ROUNDS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ export async function comparePassword(password, hash) {
|
||||
return checkWerkzeugPassword(hash, password);
|
||||
}
|
||||
if (hash.startsWith('$2')) {
|
||||
return bcrypt.compare(password, hash);
|
||||
return compare(password, hash);
|
||||
}
|
||||
return checkWerkzeugPassword(hash, password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user