accounttype and partnerid check on create account
Refined the partnerid and accounttype check in the /create route according to the /doc/Send-requirements.md Both are not mandatory but if given, they should be strings. The typeof check is for direct string initialisation with "". instanceof is used for string initialisation with new String() / the primitiv wrapper class.
This commit is contained in:
parent
7f9463bbbc
commit
e9c6f3abde
@ -139,7 +139,11 @@ const postLimiter = rateLimit({
|
||||
|
||||
router.post('/create', postLimiter, async function (req, res) {
|
||||
logger.log('/create', [req.id]);
|
||||
if (!(req.body.partnerid && req.body.partnerid === 'bluewallet' && req.body.accounttype)) return errorBadArguments(res);
|
||||
// Valid if the partnerid isn't there or is a string (same with accounttype)
|
||||
if (! (
|
||||
(!req.body.partnerid || (typeof req.body.partnerid === 'string' || req.body.partnerid instanceof String))
|
||||
&& (!req.body.accounttype || (typeof req.body.accounttype === 'string' || req.body.accounttype instanceof String))
|
||||
) ) return errorBadArguments(res);
|
||||
|
||||
if (config.sunset) return errorSunset(res);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user