Revision b9b71797 snf-astakos-app/astakos/im/management/commands/createuser.py
b/snf-astakos-app/astakos/im/management/commands/createuser.py | ||
---|---|---|
37 | 37 |
from uuid import uuid4 |
38 | 38 |
|
39 | 39 |
from django.core.management.base import BaseCommand, CommandError |
40 |
from django.core.validators import validate_email |
|
41 |
from django.core.exceptions import ValidationError |
|
40 | 42 |
|
41 | 43 |
from astakos.im.models import AstakosUser |
42 | 44 |
|
... | ... | |
74 | 76 |
args = [a.decode('utf8') for a in args] |
75 | 77 |
email, first, last, affiliation = args |
76 | 78 |
|
79 |
try: |
|
80 |
validate_email( email ) |
|
81 |
except ValidationError: |
|
82 |
raise CommandError("Invalid email") |
|
83 |
|
|
77 | 84 |
username = uuid4().hex[:30] |
78 | 85 |
password = options.get('password') |
79 | 86 |
if password is None: |
Also available in: Unified diff