Add support for reduced initial build count for new possible abusing users
If configured, we now check the IP address of the user signing up and, if they are a possible threat, we further reduce their number of allowed maximum builds to the configured value.
This commit is contained in:
parent
8d5e8fc685
commit
3309daa32e
7 changed files with 81 additions and 28 deletions
|
@ -12,7 +12,7 @@ from peewee import IntegrityError
|
|||
import features
|
||||
|
||||
from app import (app, billing as stripe, authentication, avatar, user_analytics, all_queues,
|
||||
oauth_login, namespace_gc_queue)
|
||||
oauth_login, namespace_gc_queue, ip_resolver)
|
||||
|
||||
from auth import scopes
|
||||
from auth.auth_context import get_authenticated_user
|
||||
|
@ -455,12 +455,14 @@ class User(ApiResource):
|
|||
'message': 'Are you a bot? If not, please revalidate the captcha.'
|
||||
}, 400
|
||||
|
||||
is_possible_abuser = ip_resolver.is_ip_possible_threat(request.remote_addr)
|
||||
try:
|
||||
prompts = model.user.get_default_user_prompts(features)
|
||||
new_user = model.user.create_user(user_data['username'], user_data['password'],
|
||||
user_data.get('email'),
|
||||
auto_verify=not features.MAILING,
|
||||
email_required=features.MAILING,
|
||||
is_possible_abuser=is_possible_abuser,
|
||||
prompts=prompts)
|
||||
|
||||
email_address_confirmed = handle_invite_code(invite_code, new_user)
|
||||
|
|
Reference in a new issue