Revision 21e0fdad snf-astakos-app/astakos/im/management/commands/user-update.py
b/snf-astakos-app/astakos/im/management/commands/user-update.py | ||
---|---|---|
39 | 39 |
from django.core.exceptions import ValidationError |
40 | 40 |
|
41 | 41 |
from astakos.im.models import AstakosUser |
42 |
from astakos.im.functions import activate, deactivate |
|
42 | 43 |
from ._common import remove_user_permission, add_user_permission |
43 | 44 |
|
44 | 45 |
|
... | ... | |
83 | 84 |
action='store_true', |
84 | 85 |
dest='active', |
85 | 86 |
default=False, |
86 |
help="Change user's state to inactive"),
|
|
87 |
help="Change user's state to active"), |
|
87 | 88 |
make_option('--set-inactive', |
88 | 89 |
action='store_true', |
89 | 90 |
dest='inactive', |
... | ... | |
121 | 122 |
user.is_superuser = False |
122 | 123 |
|
123 | 124 |
if options.get('active'): |
124 |
user.is_active = True |
|
125 |
if not user.email_verified: |
|
126 |
user.email_verified = True |
|
127 |
if not user.activation_sent: |
|
128 |
user.activation_sent = datetime.now() |
|
125 |
activate(user) |
|
129 | 126 |
elif options.get('inactive'): |
130 |
user.is_active = False
|
|
127 |
deactivate(user)
|
|
131 | 128 |
|
132 | 129 |
invitations = options.get('invitations') |
133 | 130 |
if invitations is not None: |
Also available in: Unified diff