mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Rate limit updates
This commit is contained in:
parent
79d6f64451
commit
d7d6ff0cca
@ -54,6 +54,11 @@ module.exports = eggspress('/change_username', {
|
||||
if(await username_exists(req.body.new_username))
|
||||
throw APIError.create('username_already_in_use', null, { username: req.body.new_username });
|
||||
|
||||
const svc_edgeRateLimit = req.services.get('edge-rate-limit');
|
||||
if ( ! svc_edgeRateLimit.check('change-email-start') ) {
|
||||
return res.status(429).send('Too many requests.');
|
||||
}
|
||||
|
||||
const db = Context.get('services').get('database').get(DB_WRITE, 'auth');
|
||||
|
||||
// Has the user already changed their username twice this month?
|
||||
|
@ -8,7 +8,7 @@ class EdgeRateLimitService extends BaseService {
|
||||
_construct () {
|
||||
this.scopes = {
|
||||
['login']: {
|
||||
limit: 3,
|
||||
limit: 10,
|
||||
window: 15 * MINUTE,
|
||||
},
|
||||
['signup']: {
|
||||
|
Loading…
Reference in New Issue
Block a user