mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
add password hashing function + easier prod
This commit is contained in:
@@ -18,10 +18,16 @@
|
||||
const bcrypt = require( 'bcrypt' );
|
||||
const db = require( '../backend/db/db.js' );
|
||||
|
||||
module.exports.checkpassword = function checkpassword ( username, password ) {
|
||||
module.exports.checkpassword = ( username, password ) => {
|
||||
return new Promise( resolve => {
|
||||
db.getDataSimple( 'admin', 'email', username ).then( data => {
|
||||
resolve( bcrypt.compareSync( password, data ) );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
module.exports.hashPassword = ( password ) => {
|
||||
return new Promise( resolve => {
|
||||
resolve( bcrypt.hashSync( password, 10 ) );
|
||||
} );
|
||||
};
|
||||
@@ -24,4 +24,10 @@ module.exports.checkpassword = function checkpassword ( email, password ) {
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
module.exports.hashPassword = ( password ) => {
|
||||
return new Promise( resolve => {
|
||||
resolve( bcrypt.hashSync( password, 10 ) );
|
||||
} );
|
||||
};
|
||||
Reference in New Issue
Block a user