mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
* fixes #1260 - playwright tests fixes #1394 - v2 search failing to find some names fixes #1374 - Search to include new objects: Campus & Carrier fixes #1164 - better rdap error reporting fixes #1368 - Facility data export into Google Earth KMZ fixes #1328 - Support web updates from a source of truth fixes #1257 - Help text covers non-compliant email addresses fixes #1313 - Improve email confirmation control - add 3 month option & maybe set new default value fixes #1380 - Reset 'Social Media' to '[]' if field has no value * linting * remove target=_blank * bump ES version to 8.10 * Cache and ES updates (#1459) * elasticsearch major version pin and relock * set decimal fields to python value on client save for load_data * force use of redis password * add default_meta to render * add generated, clean up var names * run pre-commit * update ES for https and password * rm cruft * isort --------- Co-authored-by: 20C <code@20c.com> Co-authored-by: Matt Griswold <grizz@20c.com>
35 lines
1004 B
Python
35 lines
1004 B
Python
import structlog
|
|
from django.contrib.auth.models import AnonymousUser
|
|
|
|
from peeringdb_server.inet import RdapException, RdapLookup
|
|
|
|
log = structlog.get_logger("django")
|
|
|
|
|
|
def auto_approve_ix(request, prefix):
|
|
user = request.user
|
|
|
|
if isinstance(user, AnonymousUser):
|
|
# anon user shouldnt ever be passed here, but some test cases
|
|
# do so we need to handle it
|
|
return False, "pending"
|
|
|
|
# Get administration emails of the prefix using RdapLookup
|
|
try:
|
|
rdap = RdapLookup().get_ip(prefix)
|
|
except Exception as exc:
|
|
# unhandled rdap issue, log and return pending
|
|
log.error("rdap_error", prefix=prefix, exc=exc)
|
|
return False, "pending"
|
|
|
|
# Calculate status and auto_approve values
|
|
auto_approve = False
|
|
|
|
email_address = user.emailaddress_set.filter(email__in=rdap.emails, verified=True)
|
|
if email_address.exists():
|
|
auto_approve = True
|
|
|
|
status = "ok" if auto_approve else "pending"
|
|
|
|
return auto_approve, status
|