Mercurial > public > sg101
comparison accounts/forms.py @ 893:3aecf9058130
Merge with upstream.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 17 Feb 2015 18:59:06 -0600 |
parents | 79a71b9d0a2a |
children | be233ba7ca31 |
comparison
equal
deleted
inserted
replaced
889:ae146e30d588 | 893:3aecf9058130 |
---|---|
181 self.cleaned_data['password1']) | 181 self.cleaned_data['password1']) |
182 | 182 |
183 # Send the confirmation email | 183 # Send the confirmation email |
184 | 184 |
185 site = Site.objects.get_current() | 185 site = Site.objects.get_current() |
186 admin_email = settings.ADMINS[0][1] | 186 admin_email = settings.DEFAULT_FROM_EMAIL |
187 | 187 |
188 activation_link = 'http://%s%s' % (site.domain, reverse('accounts.views.register_confirm', | 188 activation_link = 'http://%s%s' % (site.domain, reverse('accounts.views.register_confirm', |
189 kwargs = {'username' : pending_user.username, 'key' : pending_user.key})) | 189 kwargs = {'username' : pending_user.username, 'key' : pending_user.key})) |
190 | 190 |
191 msg = render_to_string('accounts/registration_email.txt', | 191 msg = render_to_string('accounts/registration_email.txt', |
197 'username' : pending_user.username, | 197 'username' : pending_user.username, |
198 'admin_email' : admin_email, | 198 'admin_email' : admin_email, |
199 }) | 199 }) |
200 | 200 |
201 subject = 'Registration Confirmation for ' + site.name | 201 subject = 'Registration Confirmation for ' + site.name |
202 send_mail(subject, msg, admin_email, [self.cleaned_data['email']], | 202 send_mail(subject, msg, admin_email, [self.cleaned_data['email']]) |
203 defer=False) | |
204 logger.info('Accounts/registration conf. email sent to %s for user %s; IP = %s', | 203 logger.info('Accounts/registration conf. email sent to %s for user %s; IP = %s', |
205 self.cleaned_data['email'], pending_user.username, self.ip) | 204 self.cleaned_data['email'], pending_user.username, self.ip) |
206 | 205 |
207 return pending_user | 206 return pending_user |
208 | 207 |
224 # nothing to do; we don't tell the user as this gives away info | 223 # nothing to do; we don't tell the user as this gives away info |
225 # about our database | 224 # about our database |
226 return | 225 return |
227 | 226 |
228 site = Site.objects.get_current() | 227 site = Site.objects.get_current() |
229 admin_email = settings.ADMINS[0][1] | 228 admin_email = settings.DEFAULT_FROM_EMAIL |
230 | 229 |
231 subject = 'Forgotten username for %s' % site.name | 230 subject = 'Forgotten username for %s' % site.name |
232 msg = render_to_string('accounts/forgot_user_email.txt', { | 231 msg = render_to_string('accounts/forgot_user_email.txt', { |
233 'user': user, | 232 'user': user, |
234 'site': site, | 233 'site': site, |
235 'admin_email': admin_email, | 234 'admin_email': admin_email, |
236 }) | 235 }) |
237 send_mail(subject, msg, admin_email, [email], defer=False) | 236 send_mail(subject, msg, admin_email, [email]) |
238 | 237 |
239 logger.info('Forgotten username email sent to {} <{}>'.format( | 238 logger.info('Forgotten username email sent to {} <{}>'.format( |
240 user.username, email)) | 239 user.username, email)) |