Skip to content

Commit

Permalink
autodetect subdomain on ip changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tugrul committed Jul 15, 2021
1 parent 80a33e1 commit 0507eb5
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 @@ -417,13 +417,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 0507eb5

Please sign in to comment.