We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Email change form
Among the account pages should be a page from which a user can change their email address. The email field on the `User` model needs to be updated and a correspondig django-allauth `EmailAddress` object should be associated with the user. django-allauth supports multiple email addresses per user, but we only want one. New email addresses should be verified with [this](http://django-allauth.readthedocs.io/en/latest/views.html#e-mail-verification). The page should be located at `/account/email/`.

@BernhardPosselt Do you agree with the above?


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nextcloudappstore/core/user/views.py`
Content:
```
1 from allauth.account.views import PasswordChangeView
2 from django.contrib import messages
3 from django.contrib.auth.mixins import LoginRequiredMixin
4 from django.contrib.auth.models import User
5 from django.core.urlresolvers import reverse_lazy
6 from django.shortcuts import redirect, render
7 from django.views.generic import TemplateView
8 from django.views.generic import UpdateView
9 
10 from nextcloudappstore.core.user.forms import DeleteAccountForm
11 
12 
13 class ChangeLanguageView(LoginRequiredMixin, TemplateView):
14     template_name = 'user/set-language.html'
15 
16     def get_context_data(self, **kwargs):
17         context = super().get_context_data(**kwargs)
18         context['acc_page'] = 'account-change-language'
19         return context
20 
21 
22 class DeleteAccountView(LoginRequiredMixin, TemplateView):
23     template_name = 'user/delete-account.html'
24 
25     def get_context_data(self, **kwargs):
26         context = super().get_context_data(**kwargs)
27         context['form'] = DeleteAccountForm()
28         context['acc_page'] = 'delete-account'
29         return context
30 
31     def post(self, request, *args, **kwargs):
32         form = DeleteAccountForm(request.POST, user=request.user)
33         if form.is_valid():
34             request.user.delete()
35             return redirect(reverse_lazy('home'))
36         else:
37             return render(request, self.template_name, {'form': form})
38 
39 
40 class AccountView(LoginRequiredMixin, UpdateView):
41     """Display and allow changing of the user's name."""
42 
43     template_name = 'user/account.html'
44     template_name_suffix = ''
45     model = User
46     fields = ['first_name', 'last_name']
47     success_url = reverse_lazy('user:account')
48 
49     def get_context_data(self, **kwargs):
50         context = super().get_context_data(**kwargs)
51         context['acc_page'] = 'account'
52         return context
53 
54     def form_valid(self, form):
55         messages.success(self.request, 'Name saved.')
56         return super().form_valid(form)
57 
58     def get_object(self, queryset=None):
59         return self.request.user
60 
61 
62 class PasswordView(LoginRequiredMixin, PasswordChangeView):
63     """Allow the user to change their password."""
64 
65     template_name = 'user/password.html'
66     success_url = reverse_lazy('user:account-password')
67 
68     def get_context_data(self, **kwargs):
69         context = super().get_context_data(**kwargs)
70         context['acc_page'] = 'password'
71         return context
72 
73 
74 class APITokenView(LoginRequiredMixin, TemplateView):
75     """Display the user's API token, and allow it to be regenerated."""
76 
77     template_name = 'user/api-token.html'
78 
79     def get_context_data(self, **kwargs):
80         context = super().get_context_data(**kwargs)
81         context['acc_page'] = 'api-token'
82         return context
83
```
--- 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/nextcloudappstore/core/user/views.py b/nextcloudappstore/core/user/views.py
--- a/nextcloudappstore/core/user/views.py
+++ b/nextcloudappstore/core/user/views.py
@@ -43,7 +43,7 @@
     template_name = 'user/account.html'
     template_name_suffix = ''
     model = User
-    fields = ['first_name', 'last_name']
+    fields = ['first_name', 'last_name', 'email']
     success_url = reverse_lazy('user:account')
 
     def get_context_data(self, **kwargs):
@@ -52,7 +52,7 @@
         return context
 
     def form_valid(self, form):
-        messages.success(self.request, 'Name saved.')
+        messages.success(self.request, 'Account details saved.')
         return super().form_valid(form)
 
     def get_object(self, queryset=None):

{"golden_diff": "diff --git a/nextcloudappstore/core/user/views.py b/nextcloudappstore/core/user/views.py\n--- a/nextcloudappstore/core/user/views.py\n+++ b/nextcloudappstore/core/user/views.py\n@@ -43,7 +43,7 @@\n     template_name = 'user/account.html'\n     template_name_suffix = ''\n     model = User\n-    fields = ['first_name', 'last_name']\n+    fields = ['first_name', 'last_name', 'email']\n     success_url = reverse_lazy('user:account')\n \n     def get_context_data(self, **kwargs):\n@@ -52,7 +52,7 @@\n         return context\n \n     def form_valid(self, form):\n-        messages.success(self.request, 'Name saved.')\n+        messages.success(self.request, 'Account details saved.')\n         return super().form_valid(form)\n \n     def get_object(self, queryset=None):\n", "issue": "Email change form\nAmong the account pages should be a page from which a user can change their email address. The email field on the `User` model needs to be updated and a correspondig django-allauth `EmailAddress` object should be associated with the user. django-allauth supports multiple email addresses per user, but we only want one. New email addresses should be verified with [this](http://django-allauth.readthedocs.io/en/latest/views.html#e-mail-verification). The page should be located at `/account/email/`.\n\n@BernhardPosselt Do you agree with the above?\n\n", "before_files": [{"content": "from allauth.account.views import PasswordChangeView\nfrom django.contrib import messages\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.contrib.auth.models import User\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.shortcuts import redirect, render\nfrom django.views.generic import TemplateView\nfrom django.views.generic import UpdateView\n\nfrom nextcloudappstore.core.user.forms import DeleteAccountForm\n\n\nclass ChangeLanguageView(LoginRequiredMixin, TemplateView):\n    template_name = 'user/set-language.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'account-change-language'\n        return context\n\n\nclass DeleteAccountView(LoginRequiredMixin, TemplateView):\n    template_name = 'user/delete-account.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['form'] = DeleteAccountForm()\n        context['acc_page'] = 'delete-account'\n        return context\n\n    def post(self, request, *args, **kwargs):\n        form = DeleteAccountForm(request.POST, user=request.user)\n        if form.is_valid():\n            request.user.delete()\n            return redirect(reverse_lazy('home'))\n        else:\n            return render(request, self.template_name, {'form': form})\n\n\nclass AccountView(LoginRequiredMixin, UpdateView):\n    \"\"\"Display and allow changing of the user's name.\"\"\"\n\n    template_name = 'user/account.html'\n    template_name_suffix = ''\n    model = User\n    fields = ['first_name', 'last_name']\n    success_url = reverse_lazy('user:account')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'account'\n        return context\n\n    def form_valid(self, form):\n        messages.success(self.request, 'Name saved.')\n        return super().form_valid(form)\n\n    def get_object(self, queryset=None):\n        return self.request.user\n\n\nclass PasswordView(LoginRequiredMixin, PasswordChangeView):\n    \"\"\"Allow the user to change their password.\"\"\"\n\n    template_name = 'user/password.html'\n    success_url = reverse_lazy('user:account-password')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'password'\n        return context\n\n\nclass APITokenView(LoginRequiredMixin, TemplateView):\n    \"\"\"Display the user's API token, and allow it to be regenerated.\"\"\"\n\n    template_name = 'user/api-token.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'api-token'\n        return context\n", "path": "nextcloudappstore/core/user/views.py"}], "after_files": [{"content": "from allauth.account.views import PasswordChangeView\nfrom django.contrib import messages\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.contrib.auth.models import User\nfrom django.core.urlresolvers import reverse_lazy\nfrom django.shortcuts import redirect, render\nfrom django.views.generic import TemplateView\nfrom django.views.generic import UpdateView\n\nfrom nextcloudappstore.core.user.forms import DeleteAccountForm\n\n\nclass ChangeLanguageView(LoginRequiredMixin, TemplateView):\n    template_name = 'user/set-language.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'account-change-language'\n        return context\n\n\nclass DeleteAccountView(LoginRequiredMixin, TemplateView):\n    template_name = 'user/delete-account.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['form'] = DeleteAccountForm()\n        context['acc_page'] = 'delete-account'\n        return context\n\n    def post(self, request, *args, **kwargs):\n        form = DeleteAccountForm(request.POST, user=request.user)\n        if form.is_valid():\n            request.user.delete()\n            return redirect(reverse_lazy('home'))\n        else:\n            return render(request, self.template_name, {'form': form})\n\n\nclass AccountView(LoginRequiredMixin, UpdateView):\n    \"\"\"Display and allow changing of the user's name.\"\"\"\n\n    template_name = 'user/account.html'\n    template_name_suffix = ''\n    model = User\n    fields = ['first_name', 'last_name', 'email']\n    success_url = reverse_lazy('user:account')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'account'\n        return context\n\n    def form_valid(self, form):\n        messages.success(self.request, 'Account details saved.')\n        return super().form_valid(form)\n\n    def get_object(self, queryset=None):\n        return self.request.user\n\n\nclass PasswordView(LoginRequiredMixin, PasswordChangeView):\n    \"\"\"Allow the user to change their password.\"\"\"\n\n    template_name = 'user/password.html'\n    success_url = reverse_lazy('user:account-password')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'password'\n        return context\n\n\nclass APITokenView(LoginRequiredMixin, TemplateView):\n    \"\"\"Display the user's API token, and allow it to be regenerated.\"\"\"\n\n    template_name = 'user/api-token.html'\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['acc_page'] = 'api-token'\n        return context\n", "path": "nextcloudappstore/core/user/views.py"}]}