refactored backend to use new naming convention for modules

This commit is contained in:
azivner
2018-04-01 21:27:46 -04:00
parent c765dbc5cf
commit e2921a648d
44 changed files with 305 additions and 310 deletions

View File

@@ -1,15 +1,15 @@
"use strict";
const utils = require('../services/utils');
const options = require('../services/options');
const my_scrypt = require('../services/my_scrypt');
const optionService = require('../services/options');
const myScryptService = require('../services/my_scrypt');
function loginPage(req, res) {
res.render('login', { failedAuth: false });
}
async function login(req, res) {
const userName = await options.getOption('username');
const userName = await optionService.getOption('username');
const guessedPassword = req.body.password;
@@ -33,9 +33,9 @@ async function login(req, res) {
}
async function verifyPassword(guessedPassword) {
const hashed_password = utils.fromBase64(await options.getOption('password_verification_hash'));
const hashed_password = utils.fromBase64(await optionService.getOption('password_verification_hash'));
const guess_hashed = await my_scrypt.getVerificationHash(guessedPassword);
const guess_hashed = await myScryptService.getVerificationHash(guessedPassword);
return guess_hashed.equals(hashed_password);
}