add more mysql stuff

This commit is contained in:
2023-07-12 09:06:29 +02:00
parent 865141d945
commit fbedf9e95e
13 changed files with 105 additions and 65 deletions

View File

@@ -9,6 +9,8 @@
const db = require( './db/db.js' );
const pwdmanager = require( './credentials/pwdmanager.js' );
const auth = require( './credentials/2fa.js' );
const twoFA = new auth();
module.exports = ( app, settings ) => {
app.post( '/api/reserveTicket', ( request, response ) => {
@@ -20,9 +22,12 @@ module.exports = ( app, settings ) => {
if ( request.body.mail && request.body.password ) {
pwdmanager.checkpassword( request.body.mail, request.body.password ).then( data => {
if ( data ) {
if ( settings.twoFA ) {
if ( settings.twoFA === 'standard' ) {
// TODO: Support both methods of 2fa
response.send( '2fa' );
} else if ( settings.twoFA === 'enhanced' ) {
// TODO: Support both methods of 2fa
response.send( '2fa+' );
} else {
request.session.loggedInUser = true;
response.send( 'ok' );
@@ -35,4 +40,8 @@ module.exports = ( app, settings ) => {
response.send( 'missingCredentials' );
}
} );
app.get( '/user/2fa', ( request, response ) => {
} );
};