diff --git a/taiga/auth/api.py b/taiga/auth/api.py index 6370f96a..a786340a 100644 --- a/taiga/auth/api.py +++ b/taiga/auth/api.py @@ -17,13 +17,10 @@ # along with this program. If not, see . from functools import partial -from enum import Enum from django.utils.translation import ugettext as _ from django.conf import settings -from taiga.base.api import validators -from taiga.base.api import serializers from taiga.base.api import viewsets from taiga.base.decorators import list_route from taiga.base import exceptions as exc @@ -91,6 +88,10 @@ class AuthViewSet(viewsets.ViewSet): @list_route(methods=["POST"]) def register(self, request, **kwargs): + accepted_terms = request.DATA.get("accepted_terms", None) + if accepted_terms in (None, False): + raise exc.BadRequest(_("You must accept our terms of service and privacy policy")) + self.check_permissions(request, 'register', None) type = request.DATA.get("type", None) diff --git a/taiga/auth/services.py b/taiga/auth/services.py index f090edf2..5498d712 100644 --- a/taiga/auth/services.py +++ b/taiga/auth/services.py @@ -115,7 +115,8 @@ def public_register(username:str, password:str, email:str, full_name:str): user_model = get_user_model() user = user_model(username=username, email=email, - full_name=full_name) + full_name=full_name, + read_new_terms=True) user.set_password(password) try: user.save()