Files
vue-pult/server/api/test-external-auth.js
sasha 3e90269b0b Initial commit: Vue.js тир управления система
- Клиентская часть Vue 3 + Vite
- Серверная часть Node.js + WebSocket
- Система авторизации и смен
- Управление игровыми портами
- Поддержка тем (светлая/темная)
- Адаптивный дизайн

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 12:24:22 +03:00

43 lines
1.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";
exports.go = async (req, res, postData, urlParsed) => {
try {
console.log('[api/test-external-auth] Тестовая авторизация пользователя на внешнем сервере');
// Проверяем соединение с внешним сервером
if (!global.conn_to_server) {
console.error('[api/test-external-auth] Нет соединения с внешним сервером');
return res.end(JSON.stringify({
success: false,
error: "Нет соединения с сервером"
}));
}
const phone = postData.phone || "79026527096";
const password = postData.password || "12340Qq";
console.log('[api/test-external-auth] Тестируем пользователя:', phone);
// Запрашиваем авторизацию пользователя напрямую через внешний сервер
const authResponse = await global.send_to_server({
do: "avt",
tel: phone,
pass: password
});
console.log('[api/test-external-auth] Ответ от внешнего сервера:', JSON.stringify(authResponse, null, 2));
res.end(JSON.stringify({
success: !authResponse.err,
phone: phone,
serverResponse: authResponse
}));
} catch (error) {
console.error('[api/test-external-auth] Критическая ошибка:', error);
res.end(JSON.stringify({
success: false,
error: "Внутренняя ошибка сервера"
}));
}
};