restruct + 2fa + auth

This commit is contained in:
2023-07-11 16:53:17 +02:00
parent d0647ba1bb
commit 865141d945
26 changed files with 279 additions and 127 deletions

View File

@@ -0,0 +1,25 @@
/*
* libreevent - pwdmanager.js
*
* Created by Janis Hutz 07/11/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.)
*/
// import and init
const bcrypt = require( 'bcrypt' );
const db = require( '../db/db.js' );
module.exports.checkpassword = function checkpassword ( username, password ) {
return new Promise( resolve => {
db.getData( 'user', username ).then( data => {
resolve( bcrypt.compareSync( password, data ) );
} );
} );
};