Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
fix user profile bug when no email
Browse files Browse the repository at this point in the history
  • Loading branch information
monty5811 committed Oct 8, 2015
1 parent 06996d7 commit 402d460
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions apostello/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,16 @@ def __str__(self):

def save(self, *args, **kwargs):
if self.pk is None:
# on first save, approve whitelisted domains
email = self.user.email
email_domain = email.split('@')[1]
safe_domains = settings.WHITELISTED_LOGIN_DOMAINS
if email_domain in safe_domains:
self.approved = True
try:
# on first save, approve whitelisted domains
email = self.user.email
email_domain = email.split('@')[1]
safe_domains = settings.WHITELISTED_LOGIN_DOMAINS
if email_domain in safe_domains:
self.approved = True
except IndexError:
# no email adress
pass
super(UserProfile, self).save(*args, **kwargs)


Expand Down

0 comments on commit 402d460

Please sign in to comment.