mirror of
https://github.com/janishutz/libreevent.git
synced 2026-04-29 14:29:25 +02:00
fix bugs, full two fa system done
This commit is contained in:
@@ -14,6 +14,7 @@ const token = require( '../token.js' );
|
||||
class TwoFA {
|
||||
constructor () {
|
||||
this.tokenStore = {};
|
||||
this.references = {};
|
||||
}
|
||||
|
||||
registerStandardAuthentication () {
|
||||
@@ -35,6 +36,14 @@ class TwoFA {
|
||||
return { 'code': code, 'token': tok };
|
||||
}
|
||||
|
||||
storeTokenReference ( token, sessionID ) {
|
||||
this.references[ token ] = sessionID;
|
||||
}
|
||||
|
||||
getTokenReference ( token ) {
|
||||
return this.references[ token ];
|
||||
}
|
||||
|
||||
verifyEnhanced ( token, number = '' ) {
|
||||
if ( this.tokenStore[ token ]?.mode === 'standard' ) return true;
|
||||
else if ( this.tokenStore[ token ]?.mode === 'enhanced' ) {
|
||||
|
||||
@@ -19,7 +19,9 @@ 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 ) );
|
||||
bcrypt.compare( password, data ).then( data => {
|
||||
resolve( data );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
Reference in New Issue
Block a user