Commit a7a3ceee authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Update snf-manage commands in email templates. Fix authentication token renewal.

parent 7b98277f
......@@ -107,7 +107,8 @@ class ActivationBackend(object):
def handle_activation(
self, user, activation_template_name='im/activation_email.txt',
greeting_template_name='im/welcome_email.txt',
admin_email_template_name='im/admin_notification.txt'
admin_email_template_name='im/account_creation_notification.txt',
helpdesk_email_template_name='im/helpdesk_notification.txt'
):
"""
If the user is already active returns immediately.
......@@ -123,10 +124,17 @@ class ActivationBackend(object):
if self._is_preaccepted(user):
if user.email_verified:
activate(user, greeting_template_name)
activate(
user,
greeting_template_name,
helpdesk_email_template_name
)
return RegistationCompleted()
else:
send_activation(user, activation_template_name)
send_activation(
user,
activation_template_name
)
return VerificationSent()
else:
send_account_creation_notification(
......
......@@ -163,7 +163,7 @@ def send_group_creation_notification(template_name, dictionary=None):
return _send_admin_notification(template_name, dictionary, subject=subject)
def send_helpdesk_notification(user, template_name='im/account_notification.txt'):
def send_helpdesk_notification(user, template_name='im/helpdesk_notification.txt'):
"""
Send email to DEFAULT_CONTACT_EMAIL to notify for a new user activation.
......@@ -275,8 +275,12 @@ def send_change_email(ec, request, email_template_name='registration/email_chang
logger.log(LOGGING_LEVEL, msg)
def activate(user, email_template_name='im/welcome_email.txt',
helpdesk_email_template_name='im/helpdesk_notification.txt', verify_email=False):
def activate(
user,
email_template_name='im/welcome_email.txt',
helpdesk_email_template_name='im/helpdesk_notification.txt',
verify_email=False
):
"""
Activates the specific user and sends email.
......
......@@ -1061,7 +1061,6 @@ def astakosuser_post_save(sender, instance, created, **kwargs):
set_default_group(instance)
# TODO handle socket.error & IOError
register_users((instance,))
instance.renew_token()
def resource_post_save(sender, instance, created, **kwargs):
......@@ -1096,7 +1095,7 @@ def on_quota_disturbed(sender, users, **kwargs):
send_quota(users)
def renew_token(sender, instance, **kwargs):
if not instance.id:
if not instance.auth_token:
instance.renew_token()
post_syncdb.connect(fix_superusers)
......
......@@ -37,9 +37,10 @@ from celery.schedules import crontab
from functools import wraps
from astakos.im.endpoints.qh import send_quota
from astakos.im.endpoints.aquarium.producer import (report_credits_event,
report_user_event
)
from astakos.im.endpoints.aquarium.producer import (
report_credits_event,
report_user_event
)
from astakos.im.endpoints.aquarium.client import AquariumClient
import logging
......
--- A translation in English follows ---
{% if group_creation %}
Έχει δημιουργηθεί ο παρακάτω λογαριασμός:
{% else %}
Έχει ενεργοποιηθεί ο παρακάτω λογαριασμός:
{% endif %}
Email: {{user.email}}
First name: {{user.first_name}}
Last name: {{user.last_name}}
Is active: {{user.is_active}}
Level: {{user.level}}
Invitations: {{user.invitations}}
{% if group_creation %}
Για την ενεργοποίησή του μπορείτε να χρησιμοποιήσετε το command line εργαλείο snf-manage user_send_activation
{% endif %}
--
{% if group_creation %}
The following account has been created:
{% else %}
The following account has been activated:
{% endif %}
Email: {{user.email}}
First name: {{user.first_name}}
Last name: {{user.last_name}}
Is active: {{user.is_active}}
Level: {{user.level}}
Invitations: {{user.invitations}}
{% if group_creation %}
For its activation you can use the command line tool snf-manage user_send_activation
{% endif %}
\ No newline at end of file
......@@ -1159,11 +1159,9 @@ def group_all(request, extra_context=None, **kwargs):
# validate sorting
sorting = 'groupname'
print '>>>', sorting, request.GET
sort_form = AstakosGroupSortForm(request.GET)
if sort_form.is_valid():
sorting = sort_form.cleaned_data.get('sorting')
print '<<<', sorting
q = q.order_by(sorting)
return object_list(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment