set password WIP

This commit is contained in:
zadam
2021-12-29 23:19:05 +01:00
parent 7e48d214ca
commit 4e31af8c84
8 changed files with 101 additions and 17 deletions

View File

@@ -9,6 +9,10 @@ function loginPage(req, res) {
res.render('login', { failedAuth: false });
}
function setPasswordPage(req, res) {
res.render('set_password', { failed: false });
}
function login(req, res) {
const userName = optionService.getOption('username');
@@ -55,6 +59,7 @@ function logout(req, res) {
module.exports = {
loginPage,
setPasswordPage,
login,
logout
};

View File

@@ -182,7 +182,8 @@ const uploadMiddleware = multer.single('upload');
function register(app) {
route(GET, '/', [auth.checkAuth, csrfMiddleware], indexRoute.index);
route(GET, '/login', [auth.checkAppInitialized], loginRoute.loginPage);
route(GET, '/login', [auth.checkAppInitialized, auth.checkPasswordSet], loginRoute.loginPage);
route(GET, '/set_password', [auth.checkAppInitialized], loginRoute.setPasswordPage);
const loginRateLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes