Poprawki i hash hasła
parent
6201f48a73
commit
47ce6c3229
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue