mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
add various things of the backend
This commit is contained in:
@@ -18,6 +18,7 @@ module.exports = ( app, settings ) => {
|
|||||||
pwdmanager.checkpassword( request.body.mail, request.body.pwd ).then( data => {
|
pwdmanager.checkpassword( request.body.mail, request.body.pwd ).then( data => {
|
||||||
if ( data ) {
|
if ( data ) {
|
||||||
if ( settings.twoFA ) {
|
if ( settings.twoFA ) {
|
||||||
|
// TODO: Support both methods of 2fa
|
||||||
response.send( '2fa' );
|
response.send( '2fa' );
|
||||||
} else {
|
} else {
|
||||||
request.session.loggedInAdmin = true;
|
request.session.loggedInAdmin = true;
|
||||||
|
|||||||
@@ -15,14 +15,15 @@ const bodyParser = require( 'body-parser' );
|
|||||||
const cookieParser = require( 'cookie-parser' );
|
const cookieParser = require( 'cookie-parser' );
|
||||||
const http = require( 'http' );
|
const http = require( 'http' );
|
||||||
const fs = require( 'fs' );
|
const fs = require( 'fs' );
|
||||||
// const sql = require( './backend/db/mysqldb.js' );
|
const sql = require( './backend/db/mysqldb.js' );
|
||||||
// const sqld = new sql();
|
const sqld = new sql();
|
||||||
|
|
||||||
// const env = process.env.PROD || false;
|
// const env = process.env.PROD || false;
|
||||||
|
|
||||||
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config.json' ) ) );
|
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config.json' ) ) );
|
||||||
|
|
||||||
// initialise express with middlewares
|
// initialise express with middlewares
|
||||||
|
// TODO: Generate random token
|
||||||
app.use( expressSession( {
|
app.use( expressSession( {
|
||||||
secret: 'gaoevgoawefgo083tq2rfvöfaf0p8',
|
secret: 'gaoevgoawefgo083tq2rfvöfaf0p8',
|
||||||
resave: true,
|
resave: true,
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ app.use( createPinia() );
|
|||||||
|
|
||||||
let userStore = useUserStore();
|
let userStore = useUserStore();
|
||||||
|
|
||||||
let prod = false;
|
let prod = true;
|
||||||
|
|
||||||
if ( prod ) {
|
if ( prod ) {
|
||||||
fetch( '/api/getAuth' ).then( res => {
|
fetch( 'http://localhost:8081/api/getAuth' ).then( res => {
|
||||||
res.json().then( data => {
|
res.json().then( data => {
|
||||||
userStore.setUserAuth( data.user );
|
userStore.setUserAuth( data.user );
|
||||||
userStore.setAdminAuth( data.admin );
|
userStore.setAdminAuth( data.admin );
|
||||||
|
|||||||
6
src/webapp/src/views/admin/TwoFA.vue
Normal file
6
src/webapp/src/views/admin/TwoFA.vue
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<div id="2fa">
|
||||||
|
<h1>Two Factor Authentication</h1>
|
||||||
|
<p>We have sent you an email containing a link for Authentication.</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user