Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port callback functions into hookset #209

Merged
merged 1 commit into from Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions account/callbacks.py

This file was deleted.

8 changes: 0 additions & 8 deletions account/conf.py
Expand Up @@ -49,19 +49,11 @@ class AccountAppConf(AppConf):
EMAIL_CONFIRMATION_URL = "account_confirm_email"
SETTINGS_REDIRECT_URL = "account_settings"
NOTIFY_ON_PASSWORD_CHANGE = True
DELETION_MARK_CALLBACK = "account.callbacks.account_delete_mark"
DELETION_EXPUNGE_CALLBACK = "account.callbacks.account_delete_expunge"
DELETION_EXPUNGE_HOURS = 48
HOOKSET = "account.hooks.AccountDefaultHookSet"
TIMEZONES = TIMEZONES
LANGUAGES = LANGUAGES
USE_AUTH_AUTHENTICATE = False

def configure_deletion_mark_callback(self, value):
return load_path_attr(value)

def configure_deletion_expunge_callback(self, value):
return load_path_attr(value)

def configure_hookset(self, value):
return load_path_attr(value)()
7 changes: 7 additions & 0 deletions account/hooks.py
Expand Up @@ -53,6 +53,13 @@ def get_user_credentials(self, form, identifier_field):
"password": form.cleaned_data["password"],
}

def account_delete_mark(self, deletion):
deletion.user.is_active = False
deletion.user.save()

def account_delete_expunge(self, deletion):
deletion.user.delete()


class HookProxy(object):

Expand Down