login system progress

This commit is contained in:
2023-03-26 12:36:21 +02:00
parent 5483f9f46c
commit aa38572aa4
8 changed files with 333 additions and 81 deletions

View File

@@ -0,0 +1,27 @@
/*
* myevent - pwdmanager.js
*
* Created by Janis Hutz 03/26/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
/*
These functions are required to verify user login and to create new users
and to hash new passwords (if user changes password.) This here is only
used for the admin panel, another one is used for the normal user accounts
to separate the two for additional security.
*/
// import and init
const bcrypt = require( 'bcrypt' );
const db = require( '../backend/db/db.js' );
module.exports.checkpassword = function checkpassword ( username, password ) {
return new Promise( resolve => {
db.getData( 'admin', username ).then( data => {
resolve( bcrypt.compareSync( password, data ) );
} );
} );
};