11import logging
22import random
33
4- from apps .constants import HHS_SERVER_LOGNAME_FMT
5-
64from django .conf import settings
75from django .urls import reverse
6+
7+ from apps .constants import HHS_SERVER_LOGNAME_FMT
88from libs .decorators import waffle_function_switch
99from libs .mail import Mailer
1010
11-
1211logger = logging .getLogger (HHS_SERVER_LOGNAME_FMT .format (__name__ ))
1312
1413
@@ -21,13 +20,17 @@ def send_activation_key_via_email(user, signup_key):
2120 """Send an email with activation key and welcome message."""
2221 activation_link = '%s%s' % (get_hostname (), reverse ('activation_verify' , args = (signup_key ,)))
2322 mailer = Mailer (
24- subject = 'Verify Your Blue Button 2.0 Developer Sandbox Account' ,
23+ subject = 'Verify Your Blue Button API Developer Sandbox Account' ,
2524 template_text = 'email/email-activate.txt' ,
2625 template_html = 'email/email-activate.html' ,
2726 to = [
2827 user .email ,
2928 ],
30- context = {'ACTIVATION_LINK' : activation_link , 'ACTIVATION_KEY' : signup_key , 'EXPIRATION' : settings .SIGNUP_TIMEOUT_DAYS },
29+ context = {
30+ 'ACTIVATION_LINK' : activation_link ,
31+ 'ACTIVATION_KEY' : signup_key ,
32+ 'EXPIRATION' : settings .SIGNUP_TIMEOUT_DAYS ,
33+ },
3134 )
3235 mailer .send ()
3336 logger .info ('Activation link sent to {} ({})' .format (user .username , user .email ))
@@ -41,7 +44,9 @@ def get_hostname():
4144 elif 'https://' in hostname .lower ():
4245 pass
4346 else :
44- logger .debug ('HOSTNAME_URL [%s] does not contain http or https prefix. Issuer:%s' % (settings .HOSTNAME_URL , hostname ))
47+ logger .debug (
48+ 'HOSTNAME_URL [%s] does not contain http or https prefix. Issuer:%s' % (settings .HOSTNAME_URL , hostname )
49+ )
4550 # no http/https prefix in HOST_NAME_URL so we add it
4651 hostname = 'https://%s' % (hostname )
4752 return hostname
0 commit comments