We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
get_newsletters during normal register is broken
If checked, the user still has get_newsletters = False. But when changed in the account settings, it's changed.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `apps/users/forms.py`
Content:
```
1 from allauth.socialaccount.adapter import get_adapter
2 from allauth.utils import email_address_exists
3 from django import forms
4 from django.contrib.auth import forms as auth_forms
5 from django.contrib.auth import get_user_model
6 from django.utils.translation import ugettext_lazy as _
7 
8 User = get_user_model()
9 
10 
11 class TermsSignupForm(auth_forms.UserCreationForm):
12     terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={
13         'required': _('Please accept the terms of use.')
14     })
15 
16     def signup(self, request, user):
17         user.signup(
18             self.cleaned_data['username'],
19             self.cleaned_data['email'],
20         )
21 
22     class Meta:
23         model = User
24         fields = ('email', 'username', 'password1', 'password2',
25                   'terms_of_use', 'get_newsletters')
26 
27 # Tried to add form as described in allauth documentation:
28 # https://django-allauth.readthedocs.io/en/latest/forms.html#socialaccount-forms
29 # ran into the following error:
30 # https://stackoverflow.com/questions/57254251/custom-form-with-socialaccount-in-django-allauth
31 # added this solution, maybe not the best
32 
33 
34 class SignupForm(forms.Form):
35     terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={
36         'required': _('Please accept the terms of use.')
37     })
38     get_newsletters = forms.BooleanField(
39         label=_('Send me newsletters'), required=False)
40     email = forms.EmailField(widget=forms.HiddenInput())
41     username = forms.CharField(widget=forms.HiddenInput())
42 
43     def __init__(self, *args, **kwargs):
44         self.sociallogin = kwargs.pop('sociallogin')
45         initial = get_adapter().get_signup_form_initial_data(
46             self.sociallogin)
47         kwargs.update({
48             'initial': initial})
49         super().__init__(*args, **kwargs)
50 
51     def save(self, request):
52         adapter = get_adapter(request)
53         user = adapter.save_user(request, self.sociallogin, form=self)
54         user.get_newsletters = self.cleaned_data['get_newsletters']
55         user.save()
56         user.signup(
57             user.username,
58             user.email
59         )
60         return user
61 
62     def clean(self):
63         email = self.cleaned_data['email']
64         if email_address_exists(email):
65             raise forms.ValidationError(
66                 get_adapter().error_messages['email_taken']
67                 % self.sociallogin.account.get_provider().name)
68         return super().clean()
69
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/apps/users/forms.py b/apps/users/forms.py
--- a/apps/users/forms.py
+++ b/apps/users/forms.py
@@ -14,6 +14,7 @@
     })
 
     def signup(self, request, user):
+        user.get_newsletters = self.cleaned_data["get_newsletters"]
         user.signup(
             self.cleaned_data['username'],
             self.cleaned_data['email'],

{"golden_diff": "diff --git a/apps/users/forms.py b/apps/users/forms.py\n--- a/apps/users/forms.py\n+++ b/apps/users/forms.py\n@@ -14,6 +14,7 @@\n     })\n \n     def signup(self, request, user):\n+        user.get_newsletters = self.cleaned_data[\"get_newsletters\"]\n         user.signup(\n             self.cleaned_data['username'],\n             self.cleaned_data['email'],\n", "issue": "get_newsletters during normal register is broken\nIf checked, the user still has get_newsletters = False. But when changed in the account settings, it's changed.\n", "before_files": [{"content": "from allauth.socialaccount.adapter import get_adapter\nfrom allauth.utils import email_address_exists\nfrom django import forms\nfrom django.contrib.auth import forms as auth_forms\nfrom django.contrib.auth import get_user_model\nfrom django.utils.translation import ugettext_lazy as _\n\nUser = get_user_model()\n\n\nclass TermsSignupForm(auth_forms.UserCreationForm):\n    terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={\n        'required': _('Please accept the terms of use.')\n    })\n\n    def signup(self, request, user):\n        user.signup(\n            self.cleaned_data['username'],\n            self.cleaned_data['email'],\n        )\n\n    class Meta:\n        model = User\n        fields = ('email', 'username', 'password1', 'password2',\n                  'terms_of_use', 'get_newsletters')\n\n# Tried to add form as described in allauth documentation:\n# https://django-allauth.readthedocs.io/en/latest/forms.html#socialaccount-forms\n# ran into the following error:\n# https://stackoverflow.com/questions/57254251/custom-form-with-socialaccount-in-django-allauth\n# added this solution, maybe not the best\n\n\nclass SignupForm(forms.Form):\n    terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={\n        'required': _('Please accept the terms of use.')\n    })\n    get_newsletters = forms.BooleanField(\n        label=_('Send me newsletters'), required=False)\n    email = forms.EmailField(widget=forms.HiddenInput())\n    username = forms.CharField(widget=forms.HiddenInput())\n\n    def __init__(self, *args, **kwargs):\n        self.sociallogin = kwargs.pop('sociallogin')\n        initial = get_adapter().get_signup_form_initial_data(\n            self.sociallogin)\n        kwargs.update({\n            'initial': initial})\n        super().__init__(*args, **kwargs)\n\n    def save(self, request):\n        adapter = get_adapter(request)\n        user = adapter.save_user(request, self.sociallogin, form=self)\n        user.get_newsletters = self.cleaned_data['get_newsletters']\n        user.save()\n        user.signup(\n            user.username,\n            user.email\n        )\n        return user\n\n    def clean(self):\n        email = self.cleaned_data['email']\n        if email_address_exists(email):\n            raise forms.ValidationError(\n                get_adapter().error_messages['email_taken']\n                % self.sociallogin.account.get_provider().name)\n        return super().clean()\n", "path": "apps/users/forms.py"}], "after_files": [{"content": "from allauth.socialaccount.adapter import get_adapter\nfrom allauth.utils import email_address_exists\nfrom django import forms\nfrom django.contrib.auth import forms as auth_forms\nfrom django.contrib.auth import get_user_model\nfrom django.utils.translation import ugettext_lazy as _\n\nUser = get_user_model()\n\n\nclass TermsSignupForm(auth_forms.UserCreationForm):\n    terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={\n        'required': _('Please accept the terms of use.')\n    })\n\n    def signup(self, request, user):\n        user.get_newsletters = self.cleaned_data[\"get_newsletters\"]\n        user.signup(\n            self.cleaned_data['username'],\n            self.cleaned_data['email'],\n        )\n\n    class Meta:\n        model = User\n        fields = ('email', 'username', 'password1', 'password2',\n                  'terms_of_use', 'get_newsletters')\n\n# Tried to add form as described in allauth documentation:\n# https://django-allauth.readthedocs.io/en/latest/forms.html#socialaccount-forms\n# ran into the following error:\n# https://stackoverflow.com/questions/57254251/custom-form-with-socialaccount-in-django-allauth\n# added this solution, maybe not the best\n\n\nclass SignupForm(forms.Form):\n    terms_of_use = forms.BooleanField(label=_('Terms of use'), error_messages={\n        'required': _('Please accept the terms of use.')\n    })\n    get_newsletters = forms.BooleanField(\n        label=_('Send me newsletters'), required=False)\n    email = forms.EmailField(widget=forms.HiddenInput())\n    username = forms.CharField(widget=forms.HiddenInput())\n\n    def __init__(self, *args, **kwargs):\n        self.sociallogin = kwargs.pop('sociallogin')\n        initial = get_adapter().get_signup_form_initial_data(\n            self.sociallogin)\n        kwargs.update({\n            'initial': initial})\n        super().__init__(*args, **kwargs)\n\n    def save(self, request):\n        adapter = get_adapter(request)\n        user = adapter.save_user(request, self.sociallogin, form=self)\n        user.get_newsletters = self.cleaned_data['get_newsletters']\n        user.save()\n        user.signup(\n            user.username,\n            user.email\n        )\n        return user\n\n    def clean(self):\n        email = self.cleaned_data['email']\n        if email_address_exists(email):\n            raise forms.ValidationError(\n                get_adapter().error_messages['email_taken']\n                % self.sociallogin.account.get_provider().name)\n        return super().clean()\n", "path": "apps/users/forms.py"}]}