diff --git a/install.sh b/install.sh index 183788e..18860fa 100644 --- a/install.sh +++ b/install.sh @@ -175,8 +175,6 @@ FINAL_PORT=$(get_random_port) # --- 4. Генерация паролей --- DB_PASS=$(openssl rand -base64 12) JWT_SECRET=$(openssl rand -base64 32) -ADMIN_USER=$(openssl rand -base64 12) -ADMIN_PASS=$(openssl rand -base64 12) log "Сгенерированы секретные ключи для БД и JWT." ################################# @@ -188,8 +186,6 @@ DB_PORT=5432 DB_USERNAME=admin DB_PASSWORD=${DB_PASS} DB_NAME=3dp_manager -ADMIN_LOGIN=${ADMIN_USER} -ADMIN_PASSWORD=${ADMIN_PASS} EOF if [[ "$USE_SSL" == "true" ]]; then @@ -416,8 +412,8 @@ if [[ "$USE_SSL" == "true" ]]; then else echo -e "${GREEN}✔ Установка завершена! Доступно по адресу: http://${UI_HOST}:${FINAL_PORT}${NC}" fi -echo "${GREEN}Логин: $ADMIN_USER" -echo "${GREEN}Пароль: $ADMIN_PASS" +echo "Логин: admin" +echo "Пароль: admin" echo "" echo "Немедленно измените пароль в Настройках утилиты!" echo "===================================================" \ No newline at end of file diff --git a/server/.env.example b/server/.env.example deleted file mode 100644 index b00d553..0000000 --- a/server/.env.example +++ /dev/null @@ -1,7 +0,0 @@ -DB_HOST=localhost -DB_PORT=5432 -DB_USERNAME=admin -DB_PASSWORD= -DB_NAME=3dp_manager -ADMIN_LOGIN=admin -ADMIN_PASSWORD= \ No newline at end of file diff --git a/server/src/auth/auth.service.ts b/server/src/auth/auth.service.ts index 9a30247..2c293d2 100644 --- a/server/src/auth/auth.service.ts +++ b/server/src/auth/auth.service.ts @@ -4,7 +4,6 @@ import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import * as bcrypt from 'bcrypt'; import { Setting } from '../settings/entities/setting.entity'; -import { ConfigService } from '@nestjs/config'; @Injectable() export class AuthService { @@ -14,7 +13,6 @@ export class AuthService { @InjectRepository(Setting) private settingsRepo: Repository, private jwtService: JwtService, - private configService: ConfigService, ) {} async validateUser(login: string, pass: string): Promise { @@ -87,14 +85,12 @@ export class AuthService { const login = await this.settingsRepo.findOne({ where: { key: 'admin_login' } }); if (!login) { - this.logger.log('Инициализация администратора...'); - const envLogin = this.configService.get('ADMIN_LOGIN') || 'admin'; - const envPass = this.configService.get('ADMIN_PASSWORD') || 'admin'; + this.logger.log('Инициализация администратора (admin / admin)...'); - const loginSetting = this.settingsRepo.create({ key: 'admin_login', value: envLogin }); + const loginSetting = this.settingsRepo.create({ key: 'admin_login', value: 'admin' }); await this.settingsRepo.save(loginSetting); - const hash = await bcrypt.hash(envPass, 10); + const hash = await bcrypt.hash('admin', 10); const passSetting = this.settingsRepo.create({ key: 'admin_password', value: hash }); await this.settingsRepo.save(passSetting);