From 47ce6c322965c06ab9006d86b43c1d59ad566ff8 Mon Sep 17 00:00:00 2001 From: kry008 Date: Wed, 8 Jan 2025 08:46:26 +0100 Subject: [PATCH] =?UTF-8?q?Poprawki=20i=20hash=20has=C5=82a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- serwer/app/apiLiczacy.js | 2 +- serwer/app/apiRoutes.js | 4 +++- serwer/app/index.js | 9 ++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/serwer/app/apiLiczacy.js b/serwer/app/apiLiczacy.js index 2d260c4..9b196b5 100644 --- a/serwer/app/apiLiczacy.js +++ b/serwer/app/apiLiczacy.js @@ -19,7 +19,7 @@ con.connect(function(err) { }); var bodyParser = require('body-parser'); apiLiczacy.use(bodyParser.json()); -const {loger, sendToDiscord, sendEmail, makeid, checkSendEmail, baza} = require('./func.js'); +const {loger, sendToDiscord, sendEmail} = require('./func.js'); apiLiczacy.use(function(req, res, next) { var token = req.headers.token || req.body.token; diff --git a/serwer/app/apiRoutes.js b/serwer/app/apiRoutes.js index c27ef73..988eee7 100644 --- a/serwer/app/apiRoutes.js +++ b/serwer/app/apiRoutes.js @@ -25,7 +25,9 @@ api.use(bodyParser.json()); api.post("/loginPanel", function(req, res) { var login = req.body.login; var password = req.body.password; - con.query("SELECT * FROM login WHERE login = ? AND haslo = ?", [login, password], function(err, result) { + console.log(req.body); + + con.query("SELECT * FROM login WHERE login = ? AND haslo = SHA1(?)", [login, password], function(err, result) { //jeżeli znajdziesz wygeneruj token i zapamiętaj go w bazie if (result.length > 0) { var token = makeid(64); diff --git a/serwer/app/index.js b/serwer/app/index.js index 3dd41d1..3e6c7bd 100644 --- a/serwer/app/index.js +++ b/serwer/app/index.js @@ -66,6 +66,10 @@ function tryConnect() { const liczacy = require('./liczacy.js'); const apiRoutes = require('./apiRoutes.js'); + app.use('/panel', panelRoutes); + app.use('/liczacy', liczacy); + app.use('/api', apiRoutes); + app.get('/', function(req, res) { res.redirect('/panel'); }); @@ -184,11 +188,6 @@ function tryConnect() { res.redirect('/panel/home'); }); - - app.use('/panel', panelRoutes); - app.use('/liczacy', liczacy); - app.use('/api', apiRoutes); - app.all('/statystyki2', function(req, res) { var toReturn = headerHtml("Statystyki"); toReturn += menuHtml(0);