Skip to content

Commit

Permalink
fix: save_account case for disable_user_signup
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Jan 14, 2025
1 parent 8d5860d commit 766c235
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/backend/src/routers/save_account.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"use strict"
const express = require('express');
const router = new express.Router();
const {get_taskbar_items, username_exists, send_email_verification_code, send_email_verification_token, invalidate_cached_user, get_user } = require('../helpers');
const {
get_taskbar_items, username_exists, send_email_verification_code, send_email_verification_token, invalidate_cached_user, get_user,
is_user_signup_disabled: lazy_user_signup,
} = require('../helpers');
const auth = require('../middleware/auth.js');
const config = require('../config');
const { DB_WRITE } = require('../services/database/consts');
Expand All @@ -32,6 +35,11 @@ router.post('/save_account', auth, express.json(), async (req, res, next)=>{
if(require('../helpers').subdomain(req) !== 'api' && require('../helpers').subdomain(req) !== '')
next();

const is_user_signup_disabled = await lazy_user_signup();
if ( is_user_signup_disabled ) {
return res.status(403).send('User signup is disabled.');
}

// modules
const db = req.services.get('database').get(DB_WRITE, 'auth');
const validator = require('validator')
Expand Down

0 comments on commit 766c235

Please sign in to comment.