Revision 1cbce16f

b/snf-astakos-app/Changelog
2 2
---------
3 3
next
4 4
^^^^
5

  
6
- Setting ASTAKOS_DEFAULT_ADMIN_EMAIL has been deprecated. Use ADMINS django setting instead.
7
- Setting ASTAKOS_DEFAULT_FROM_EMAIL has been deprecated. Use SERVER_EMAIL django setting instead.
8

  
9
0.7.3
10
^^^^
5 11
- Rename management commands
6 12
- Optionally renew token on password change
7 13
- Preserve local password for users switched to shibboleth
b/snf-astakos-app/README
46 46
ASTAKOS_AUTH_TOKEN_DURATION         one month                                                                       Expiration time of newly created auth tokens
47 47
ASTAKOS_DEFAULT_USER_LEVEL          4                                                                               Default (not-invited) user level
48 48
ASTAKOS_INVITATIONS_PER_LEVEL       {0:100, 1:2, 2:0, 3:0, 4:0}                                                     Number of user invitations per user level
49
ASTAKOS_DEFAULT_FROM_EMAIL          GRNET Cloud <no-reply\@grnet.gr>                                                ``from`` parameter passed in ``django.core.mail.send_mail``
50 49
ASTAKOS_DEFAULT_CONTACT_EMAIL       support\@cloud.grnet.gr                                                         Contact email
51
ASTAKOS_DEFAULT_ADMIN_EMAIL         support\@cloud.grnet.gr                                                         Administrator email to receive user creation notifications (if None disables notifications)
52 50
ASTAKOS_IM_MODULES                  ['local', 'shibboleth']                                                         Signup modules
53 51
ASTAKOS_FORCE_PROFILE_UPDATE        True                                                                            Force user profile verification
54 52
ASTAKOS_INVITATIONS_ENABLED         True                                                                            Enable invitations
......
81 79
ASTAKOS_EMAILCHANGE_ENABLED         False                                                                           Enable email change mechanism
82 80
ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS 10                                                                              Number of days that email change requests remain active
83 81
ASTAKOS_LOGGING_LEVEL               INFO                                                                            Message logging severity
82
ASTAKOS_QUOTA_HOLDER_URL            ''                                                                              The quota holder URI
84 83
=================================== =============================================================================   ===========================================================================================
85 84

  
86 85
Administrator functions
b/snf-astakos-app/astakos/im/forms.py
45 45
from django.utils.safestring import mark_safe
46 46
from django.utils.encoding import smart_str
47 47
from django.forms.extras.widgets import SelectDateWidget
48
from django.conf import settings
48 49

  
49 50
from astakos.im.models import (AstakosUser, EmailChange, AstakosGroup, Invitation,
50 51
    Membership, GroupKind, get_latest_terms
51 52
)
52
from astakos.im.settings import (INVITATIONS_PER_LEVEL, DEFAULT_FROM_EMAIL,
53
    BASEURL, SITENAME, RECAPTCHA_PRIVATE_KEY, DEFAULT_CONTACT_EMAIL,
54
    RECAPTCHA_ENABLED, LOGGING_LEVEL
53
from astakos.im.settings import (INVITATIONS_PER_LEVEL, BASEURL, SITENAME,
54
    RECAPTCHA_PRIVATE_KEY, RECAPTCHA_ENABLED, DEFAULT_CONTACT_EMAIL,
55
    LOGGING_LEVEL
55 56
)
56 57
from astakos.im.widgets import DummyWidget, RecaptchaWidget
57 58
from astakos.im.functions import send_change_email
......
401 402
        """
402 403
        for user in self.users_cache:
403 404
            url = reverse('django.contrib.auth.views.password_reset_confirm',
404
                          kwargs={'uidb36':int_to_base36(user.id),
405
                                  'token':token_generator.make_token(user)})
405
                kwargs={'uidb36':int_to_base36(user.id),
406
                    'token':token_generator.make_token(user)
407
                }
408
            )
406 409
            url = urljoin(BASEURL, url)
407 410
            t = loader.get_template(email_template_name)
408 411
            c = {
......
413 416
                'baseurl': BASEURL,
414 417
                'support': DEFAULT_CONTACT_EMAIL
415 418
            }
416
            from_email = DEFAULT_FROM_EMAIL
419
            from_email = settings.SERVER_EMAIL
417 420
            send_mail(_("Password reset on %s alpha2 testing") % SITENAME,
418 421
                t.render(Context(c)), from_email, [user.email])
419 422

  
b/snf-astakos-app/astakos/im/functions.py
42 42
from django.template import Context, loader
43 43
from django.contrib.auth import login as auth_login, logout as auth_logout
44 44
from django.http import HttpRequest
45
from django.conf import settings
45 46

  
46 47
from urllib import quote
47 48
from urlparse import urljoin
......
49 50
from datetime import datetime
50 51
from functools import wraps
51 52

  
52
from astakos.im.settings import DEFAULT_CONTACT_EMAIL, DEFAULT_FROM_EMAIL, \
53
    SITENAME, BASEURL, DEFAULT_ADMIN_EMAIL, LOGGING_LEVEL
53
from astakos.im.settings import (DEFAULT_CONTACT_EMAIL, SITENAME, BASEURL,
54
    LOGGING_LEVEL
55
)
54 56
from astakos.im.models import AstakosUser
55 57

  
56 58
logger = logging.getLogger(__name__)
......
90 92
            'baseurl': BASEURL,
91 93
            'site_name': SITENAME,
92 94
            'support': DEFAULT_CONTACT_EMAIL})
93
    sender = DEFAULT_FROM_EMAIL
95
    sender = settings.SERVER_EMAIL
94 96
    try:
95 97
        send_mail('%s alpha2 testing account activation is needed' % SITENAME, message, sender, [user.email])
96 98
    except (SMTPException, socket.error) as e:
......
110 112
    subject='alpha2 testing notification',
111 113
):
112 114
    """
113
    Send notification email to DEFAULT_ADMIN_EMAIL.
115
    Send notification email to settings.ADMINS.
114 116
    
115 117
    Raises SendNotificationError
116 118
    """
117
    if not DEFAULT_ADMIN_EMAIL:
119
    if not settings.ADMINS:
118 120
        return
119 121
    dictionary = dictionary or {}
120 122
    message = render_to_string(template_name, dictionary)
121
    sender = DEFAULT_FROM_EMAIL
123
    sender = settings.SERVER_EMAIL
122 124
    try:
123
        send_mail(subject, message, sender, [DEFAULT_ADMIN_EMAIL])
125
        send_mail(subject, message, sender, [i[1] for i in settings.ADMINS])
124 126
    except (SMTPException, socket.error) as e:
125 127
        logger.exception(e)
126 128
        raise SendNotificationError()
......
140 142
        template_name,
141 143
        {'user': user}
142 144
    )
143
    sender = DEFAULT_FROM_EMAIL
145
    sender = settings.SERVER_EMAIL
144 146
    try:
145 147
        send_mail(
146 148
            '%s alpha2 testing account activated' % SITENAME,
......
169 171
                'baseurl': BASEURL,
170 172
                'site_name': SITENAME,
171 173
                'support': DEFAULT_CONTACT_EMAIL})
172
    sender = DEFAULT_FROM_EMAIL
174
    sender = settings.SERVER_EMAIL
173 175
    try:
174 176
        send_mail(subject, message, sender, [invitation.username])
175 177
    except (SMTPException, socket.error) as e:
......
192 194
                'baseurl': BASEURL,
193 195
                'site_name': SITENAME,
194 196
                'support': DEFAULT_CONTACT_EMAIL})
195
    sender = DEFAULT_FROM_EMAIL
197
    sender = settings.SERVER_EMAIL
196 198
    try:
197 199
        send_mail(subject, message, sender, [user.email])
198 200
    except (SMTPException, socket.error) as e:
......
226 228
        url = request.build_absolute_uri(url)
227 229
        t = loader.get_template(email_template_name)
228 230
        c = {'url': url, 'site_name': SITENAME}
229
        from_email = DEFAULT_FROM_EMAIL
231
        from_email = settings.SERVER_EMAIL
230 232
        send_mail(_("Email change on %s alpha2 testing") % SITENAME,
231 233
            t.render(Context(c)), from_email, [ec.new_email_address])
232 234
    except (SMTPException, socket.error) as e:
b/snf-astakos-app/astakos/im/settings.py
19 19
})
20 20

  
21 21
# Address to use for outgoing emails
22
DEFAULT_FROM_EMAIL = getattr(settings, 'ASTAKOS_DEFAULT_FROM_EMAIL', 'GRNET Cloud <no-reply@grnet.gr>')
23 22
DEFAULT_CONTACT_EMAIL = getattr(settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@cloud.grnet.gr')
24
DEFAULT_ADMIN_EMAIL = getattr(settings, 'ASTAKOS_DEFAULT_ADMIN_EMAIL', 'support@cloud.grnet.gr')
25 23

  
26 24
# Identity Management enabled modules
27 25
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local', 'shibboleth'])
......
87 85
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'}
88 86
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {})
89 87

  
90
# The number of unsuccessful login requests per minute allowed for a specific email
88
# The number of unsuccessful login requests per minute allowed for a specific user
91 89
RATELIMIT_RETRIES_ALLOWED = getattr(settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
92 90

  
93 91
# If False the email change mechanism is disabled
......
100 98
from logging import INFO
101 99
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
102 100

  
101
# Set the quota holder component URI
103 102
QUOTA_HOLDER_URL = getattr(settings, 'ASTAKOS_QUOTA_HOLDER_URL', '')
b/snf-astakos-app/conf/20-snf-astakos-app-settings.conf~
17 17
#}
18 18

  
19 19
# Address to use for outgoing emails
20
#ASTAKOS_DEFAULT_FROM_EMAIL = 'GRNET Cloud <no-reply@grnet.gr>'
20
#ASTAKOS_DEFAULT_FROM_EMAIL = 'GRNET Cloud <no-reply@grnet.gr>' #Deprecated: use SERVER_EMAIL instead
21 21
#ASTAKOS_DEFAULT_CONTACT_EMAIL = 'support@cloud.grnet.gr'
22
#ASTAKOS_DEFAULT_ADMIN_EMAIL = 'admin@cloud.grnet.gr'
22
#ASTAKOS_DEFAULT_ADMIN_EMAIL = 'admin@cloud.grnet.gr' #Deprecated: use ADMINS instead
23 23

  
24 24
# Identity Management enabled modules
25 25
#ASTAKOS_IM_MODULES = ['local', 'twitter', 'shibboleth']
......
82 82
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'}
83 83
#ASTAKOS_PROFILE_EXTRA_LINKS = {}
84 84

  
85
# The number of unsuccessful login requests per minute allowed for a specific user
86
#ASTAKOS_RATELIMIT_RETRIES_ALLOWED = 3
87

  
88
# If set to False the email change mechanism is disabled
89
#ASTAKOS_EMAILCHANGE_ENABLED = False
90

  
91
# Set the expiration time (in days) of email change requests
92
#ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS = 10
93

  
94
# Set the astakos main functions logging severity (None to disable)
95
#ASTAKOS_LOGGING_LEVEL = INFO
96

  
97
# Set the quota holder component URI
98
ASTAKOS_QUOTA_HOLDER_URL = ''

Also available in: Unified diff