add various things of the backend

This commit is contained in:
2023-07-09 19:53:55 +02:00
parent fc4b18274b
commit 29a68edc0c
4 changed files with 12 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ module.exports = ( app, settings ) => {
pwdmanager.checkpassword( request.body.mail, request.body.pwd ).then( data => {
if ( data ) {
if ( settings.twoFA ) {
// TODO: Support both methods of 2fa
response.send( '2fa' );
} else {
request.session.loggedInAdmin = true;

View File

@@ -15,14 +15,15 @@ const bodyParser = require( 'body-parser' );
const cookieParser = require( 'cookie-parser' );
const http = require( 'http' );
const fs = require( 'fs' );
// const sql = require( './backend/db/mysqldb.js' );
// const sqld = new sql();
const sql = require( './backend/db/mysqldb.js' );
const sqld = new sql();
// const env = process.env.PROD || false;
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config.json' ) ) );
// initialise express with middlewares
// TODO: Generate random token
app.use( expressSession( {
secret: 'gaoevgoawefgo083tq2rfvöfaf0p8',
resave: true,