2018-05-06 10:50:53 +00:00
|
|
|
from allauth.account.adapter import DefaultAccountAdapter
|
2018-06-10 08:55:16 +00:00
|
|
|
from django.conf import settings
|
2018-02-24 11:20:42 +00:00
|
|
|
from dynamic_preferences.registries import global_preferences_registry
|
2017-06-23 21:00:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FunkwhaleAccountAdapter(DefaultAccountAdapter):
|
|
|
|
def is_open_for_signup(self, request):
|
2018-02-24 11:20:42 +00:00
|
|
|
manager = global_preferences_registry.manager()
|
2018-06-09 13:36:16 +00:00
|
|
|
return manager["users__registration_enabled"]
|
2018-05-06 10:50:53 +00:00
|
|
|
|
|
|
|
def send_mail(self, template_prefix, email, context):
|
2018-06-09 13:36:16 +00:00
|
|
|
context["funkwhale_url"] = settings.FUNKWHALE_URL
|
2018-05-06 10:50:53 +00:00
|
|
|
return super().send_mail(template_prefix, email, context)
|