mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
add root accounts
This commit is contained in:
@@ -88,6 +88,16 @@ class GETHandler {
|
||||
resolve( this.settings.currency );
|
||||
} else if ( call === 'getAdminAccounts' ) {
|
||||
db.getData( 'admin' ).then( data => {
|
||||
if ( data[ 0 ] ) {
|
||||
resolve( { 'data': data, 'status': 'ok' } );
|
||||
} else {
|
||||
resolve( { 'data': {}, 'status': 'empty' } );
|
||||
}
|
||||
} ).catch( err => {
|
||||
reject( { 'code': 500, 'message': 'ERR_DB: ' + err } );
|
||||
} );
|
||||
} else if ( call === 'getRootAccountDetails' ) {
|
||||
db.getJSONData( 'rootAccount' ).then( data => {
|
||||
resolve( data );
|
||||
} ).catch( err => {
|
||||
reject( { 'code': 500, 'message': 'ERR_DB: ' + err } );
|
||||
|
||||
@@ -20,19 +20,27 @@ const db = require( '../backend/db/db.js' );
|
||||
|
||||
module.exports.checkpassword = ( username, password ) => {
|
||||
return new Promise( resolve => {
|
||||
db.getDataSimple( 'admin', 'email', username ).then( data => {
|
||||
if ( data ) {
|
||||
if ( data[ 0 ] ) {
|
||||
bcrypt.compare( password, data[ 0 ].pass ).then( res => {
|
||||
resolve( { 'status': res, 'twoFA': data[ 0 ].two_fa } );
|
||||
} );
|
||||
if ( username === 'root' ) {
|
||||
db.getJSONData( 'rootAccount' ).then( account => {
|
||||
bcrypt.compare( password, account.pass ).then( res => {
|
||||
resolve( { 'status': res, 'twoFA': true } );
|
||||
} );
|
||||
} );
|
||||
} else {
|
||||
db.getDataSimple( 'admin', 'email', username ).then( data => {
|
||||
if ( data ) {
|
||||
if ( data[ 0 ] ) {
|
||||
bcrypt.compare( password, data[ 0 ].pass ).then( res => {
|
||||
resolve( { 'status': res, 'twoFA': data[ 0 ].two_fa } );
|
||||
} );
|
||||
} else {
|
||||
resolve( false );
|
||||
}
|
||||
} else {
|
||||
resolve( false );
|
||||
}
|
||||
} else {
|
||||
resolve( false );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
0
src/server/backend/db/data/rootAccount.json
Normal file
0
src/server/backend/db/data/rootAccount.json
Normal file
@@ -3,11 +3,23 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ pageName }}</title>
|
||||
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"> -->
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="/supportFiles/style.css">
|
||||
<link rel="stylesheet" href="/startPage/mainStyle">
|
||||
<script defer src="/startPage/helperFunction"></script>
|
||||
<title>{{ pageName }} :: Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<nav>
|
||||
<a class="home">Home</a> |
|
||||
<a href="/tickets">Tickets</a> |
|
||||
<a href="/cart">Cart</a> |
|
||||
<a href="/account">Account</a> |
|
||||
<button onclick="changeTheme();" id="themeSelector">☽</button>
|
||||
</nav>
|
||||
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
|
||||
<h1>Welcome to {{ pageName }}!</h1>
|
||||
<p>{{ description }}</p>
|
||||
</body>
|
||||
</html>
|
||||
0
src/server/ui/home/templates/default/startPage.json
Normal file
0
src/server/ui/home/templates/default/startPage.json
Normal file
25
src/server/ui/home/templates/modern/index.html
Normal file
25
src/server/ui/home/templates/modern/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"> -->
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="/supportFiles/style.css">
|
||||
<link rel="stylesheet" href="/startPage/mainStyle">
|
||||
<script defer src="/startPage/helperFunction"></script>
|
||||
<title>{{ pageName }} :: Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a class="home">Home</a> |
|
||||
<a href="/tickets">Tickets</a> |
|
||||
<a href="/cart">Cart</a> |
|
||||
<a href="/account">Account</a> |
|
||||
<button onclick="changeTheme();" id="themeSelector">☽</button>
|
||||
</nav>
|
||||
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
|
||||
<h1>Welcome to {{ pageName }}!</h1>
|
||||
<p>{{ description }}</p>
|
||||
</body>
|
||||
</html>
|
||||
25
src/server/ui/home/templates/template.html
Normal file
25
src/server/ui/home/templates/template.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"> -->
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="/supportFiles/style.css">
|
||||
<link rel="stylesheet" href="/startPage/mainStyle">
|
||||
<script defer src="/startPage/helperFunction"></script>
|
||||
<title>{{ pageName }} :: Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a class="home">Home</a> |
|
||||
<a href="/tickets">Tickets</a> |
|
||||
<a href="/cart">Cart</a> |
|
||||
<a href="/account">Account</a> |
|
||||
<button onclick="changeTheme();" id="themeSelector">☽</button>
|
||||
</nav>
|
||||
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
|
||||
<h1>Welcome to {{ pageName }}!</h1>
|
||||
<p>{{ description }}</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user