forked from vinta/django-email-confirm-la
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
176 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
# coding: utf-8 | ||
|
||
from django.conf import settings | ||
from django.core.exceptions import ImproperlyConfigured | ||
|
||
from appconf import AppConf | ||
|
||
class DefaultConfigs(object): | ||
|
||
class ECLAAppConf(AppConf): | ||
EMAIL_BACKEND = settings.EMAIL_BACKEND | ||
HTTP_PROTOCOL = 'http' | ||
DOMAIN = '' | ||
CONFIRM_EXPIRE_SEC = 60 * 60 * 24 * 1 # 1 day | ||
CONFIRM_URL_REVERSE_NAME = 'confirm_email' | ||
EMAIL_CONFIRM_LA_HTTP_PROTOCOL = 'http' | ||
EMAIL_CONFIRM_LA_DOMAIN = 'example.com' | ||
EMAIL_CONFIRM_LA_CONFIRM_EXPIRE_SEC = 60 * 60 * 24 * 1 # 1 day | ||
EMAIL_CONFIRM_LA_CONFIRM_URL_REVERSE_NAME = 'email_confirm_la:confirm_email' | ||
|
||
# TODO: EMAIL UNIQUE OR NOT | ||
# unique_together = (('content_type', 'email_field_name', 'email'), ) | ||
|
||
class Meta: | ||
prefix = 'email_confirm_la' | ||
class Configs(object): | ||
|
||
def configure_domain(self, value): | ||
from django.contrib.sites.models import Site | ||
def __getattr__(self, name): | ||
default_setting = getattr(DefaultConfigs, name) | ||
setting = getattr(settings, name, default_setting) | ||
|
||
if not value: | ||
try: | ||
current_site = Site.objects.get_current() | ||
except ImproperlyConfigured: | ||
raise ImproperlyConfigured("You need to provide `EMAIL_CONFIRM_LA_DOMAIN` in settings if you don't use the sites framework.") | ||
else: | ||
value = current_site.domain | ||
return setting | ||
|
||
return value | ||
|
||
configs = Configs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# coding: utf-8 | ||
|
||
|
||
class EmailConfirmationExpired(Exception): | ||
class ExpiredError(Exception): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# coding: utf-8 | ||
|
||
import django.dispatch | ||
from django.dispatch import Signal | ||
|
||
|
||
post_email_confirmation_send = django.dispatch.Signal(providing_args=['confirmation', ]) | ||
post_email_confirmation_confirm = django.dispatch.Signal(providing_args=['confirmation', ]) | ||
post_email_confirmation_send = Signal(providing_args=['confirmation', ]) | ||
post_email_confirmation_confirm = Signal(providing_args=['confirmation', 'save_to_content_object']) |
Oops, something went wrong.