Skip to content

Commit

Permalink
Merge pull request #5 from bluecherrydvr/autodetect_subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
curtishall authored Aug 7, 2021
2 parents d434652 + 0507eb5 commit 91fed2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,18 @@ router.post('/ban-subdomain', adminAuthChecker, wrap(async(req, res) => {
router.post('/assign-ip-address', clientAuthChecker, wrap( async (req, res) => {

const {authToken} = res.locals;
const {ip_address, subdomain, type = 4} = req.body;
const {ip_address, type = 4} = req.body;
let {subdomain} = req.body;

if (!ip_address) {
res.json({success: false, message: 'ip address is not provided'});
return;
}

if (!subdomain) {
subdomain = await redisClient.hget('client_subdomains_last', authToken);
}

if (!subdomain) {
res.json({success: false, message: 'subdomain is not provided'});
return;
Expand Down

0 comments on commit 91fed2c

Please sign in to comment.