forked from indymedia/epicyon
Remove email address if invalid
parent
1a347ac878
commit
dd8650b717
15
pgp.py
15
pgp.py
|
@ -78,6 +78,14 @@ def getPGPfingerprint(actorJson: {}) -> str:
|
||||||
def setEmailAddress(actorJson: {}, emailAddress: str) -> None:
|
def setEmailAddress(actorJson: {}, emailAddress: str) -> None:
|
||||||
"""Sets the email address for the given actor
|
"""Sets the email address for the given actor
|
||||||
"""
|
"""
|
||||||
|
notEmailAddress = False
|
||||||
|
if '@' not in emailAddress:
|
||||||
|
notEmailAddress = True
|
||||||
|
if '.' not in emailAddress:
|
||||||
|
notEmailAddress = True
|
||||||
|
if emailAddress.startswith('@'):
|
||||||
|
notEmailAddress = True
|
||||||
|
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
|
@ -94,12 +102,7 @@ def setEmailAddress(actorJson: {}, emailAddress: str) -> None:
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
if notEmailAddress:
|
||||||
if '@' not in emailAddress:
|
|
||||||
return
|
|
||||||
if '.' not in emailAddress:
|
|
||||||
return
|
|
||||||
if emailAddress.startswith('@'):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for propertyValue in actorJson['attachment']:
|
for propertyValue in actorJson['attachment']:
|
||||||
|
|
Loading…
Reference in New Issue