prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  No warning/help text when password entered incorrectly
  When I try to log in with the wrong log in details, I don't get a message informing me what didn't work - i.e. wrong password/log in (Firefox, 47 on Mac).
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `euth/user_management/forms.py`
  Content:
  ```
  1 from django import forms
  2 from django.contrib.auth import authenticate, get_user_model
  3 from django.contrib.auth.hashers import make_password
  4 from django.core.exceptions import ValidationError
  5 from django.utils.translation import ugettext as _
  6 
  7 from .models import Registration, Reset
  8 
  9 User = get_user_model()
  10 
  11 
  12 class LoginForm(forms.Form):
  13     email = forms.EmailField(max_length=255, required=True)
  14     password = forms.CharField(widget=forms.PasswordInput, required=True)
  15 
  16     def clean(self):
  17         email = self.cleaned_data.get('email')
  18         password = self.cleaned_data.get('password')
  19         user = authenticate(username=email, password=password)
  20         if not user or not user.is_active:
  21             raise ValidationError(_('password mismatch'))
  22         return self.cleaned_data
  23 
  24     def login(self, request):
  25         email = self.cleaned_data.get('email')
  26         password = self.cleaned_data.get('password')
  27         user = authenticate(username=email, password=password)
  28         return user
  29 
  30 
  31 class RegisterForm(forms.Form):
  32     email = forms.EmailField(max_length=255, required=True)
  33     username = forms.CharField(max_length=255, required=True)
  34     password = forms.CharField(
  35         widget=forms.PasswordInput,
  36         min_length=8,
  37         required=True)
  38     password_repeat = forms.CharField(
  39         widget=forms.PasswordInput, required=True)
  40 
  41     def clean_password_repeat(self):
  42         password1 = self.cleaned_data.get('password')
  43         password2 = self.cleaned_data.get('password_repeat')
  44         if password1 != password2:
  45             raise ValidationError(_('passwords dont match'))
  46         return password2
  47 
  48     def clean_username(self):
  49         username = self.cleaned_data.get('username')
  50         user_exists = User.objects.filter(
  51             username=username).first() is not None
  52         register_exits = Registration.objects.filter(
  53             username=username).first() is not None
  54 
  55         if user_exists or register_exits:
  56             raise ValidationError(_('username taken'))
  57         return username
  58 
  59     def clean_email(self):
  60         email = self.cleaned_data.get('email')
  61         user_exists = User.objects.filter(email=email).first()
  62         register_exists = Registration.objects.filter(email=email).first()
  63         if user_exists or register_exists:
  64             raise ValidationError(_('email in use'))
  65         return email
  66 
  67     def register(self, request):
  68         username = self.cleaned_data.get('username')
  69         password = self.cleaned_data.get('password')
  70         email = self.cleaned_data.get('email')
  71         registration = Registration(username=username,
  72                                     email=email,
  73                                     password=make_password(password))
  74         return registration
  75 
  76 
  77 class ActivateForm(forms.Form):
  78     token = forms.UUIDField(widget=forms.HiddenInput(), required=True)
  79 
  80     def clean_token(self):
  81         token = self.cleaned_data.get('token')
  82         registration = Registration.objects.filter(token=token).first()
  83         if not registration:
  84             raise ValidationError(_('invalid token'))
  85         else:
  86             self.cleaned_data['registration'] = registration
  87         return token
  88 
  89     def activate(self, request):
  90         registration = self.cleaned_data.get('registration')
  91         user = User(username=registration.username,
  92                     email=registration.email,
  93                     password=registration.password)
  94         return user, registration
  95 
  96 
  97 class RequestResetForm(forms.Form):
  98     username_or_email = forms.CharField(max_length=255)
  99 
  100     def clean_username_or_email(self):
  101         username_or_email = self.cleaned_data.get('username_or_email')
  102         user = (User.objects.filter(username=username_or_email).first() or
  103                 User.objects.filter(email=username_or_email).first())
  104         if not user:
  105             raise ValidationError(_('unkown user'))
  106         else:
  107             self.cleaned_data['user'] = user
  108             return username_or_email
  109 
  110     def request_reset(self, request):
  111         user = self.cleaned_data.get('user')
  112         return Reset(user=user)
  113 
  114 
  115 class ResetForm(forms.Form):
  116     token = forms.UUIDField(widget=forms.HiddenInput(), required=True)
  117     password = forms.CharField(
  118         widget=forms.PasswordInput,
  119         min_length=8,
  120         required=True)
  121     password_repeat = forms.CharField(
  122         widget=forms.PasswordInput,
  123         required=True)
  124 
  125     def clean_token(self):
  126         token = self.cleaned_data.get('token')
  127         reset = Reset.objects.filter(token=token).first()
  128         if not reset:
  129             ValidationError(_('invalid token'))
  130         else:
  131             self.cleaned_data['reset'] = reset
  132         return token
  133 
  134     def clean_password_repeat(self):
  135         password1 = self.cleaned_data.get('password')
  136         password2 = self.cleaned_data.get('password_repeat')
  137         if password1 != password2:
  138             raise ValidationError(_('passwords dont match'))
  139         return password2
  140 
  141     def reset_password(self, request):
  142         reset = self.cleaned_data.get('reset')
  143         password = self.cleaned_data.get('password')
  144         user = reset.user
  145         user.password = make_password(password)
  146         return user, reset
  147
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/euth/user_management/forms.py b/euth/user_management/forms.py
  --- a/euth/user_management/forms.py
  +++ b/euth/user_management/forms.py
  @@ -15,6 +15,12 @@
   
       def clean(self):
           email = self.cleaned_data.get('email')
  +        if email and not User.objects.filter(email=email):
  +            if Registration.objects.filter(email=email):
  +                raise ValidationError(_('account not activated'))
  +            else:
  +                raise ValidationError(_('account doesn\'t exist'))
  +
           password = self.cleaned_data.get('password')
           user = authenticate(username=email, password=password)
           if not user or not user.is_active:
  @@ -42,7 +48,7 @@
           password1 = self.cleaned_data.get('password')
           password2 = self.cleaned_data.get('password_repeat')
           if password1 != password2:
  -            raise ValidationError(_('passwords dont match'))
  +            raise ValidationError(_('passwords don\'t match'))
           return password2
   
       def clean_username(self):
  @@ -134,8 +140,8 @@
       def clean_password_repeat(self):
           password1 = self.cleaned_data.get('password')
           password2 = self.cleaned_data.get('password_repeat')
  -        if password1 != password2:
  -            raise ValidationError(_('passwords dont match'))
  +        if password1 and password1 != password2:
  +            raise ValidationError(_('passwords don\'t match'))
           return password2
   
       def reset_password(self, request):
  
verification_info: {"golden_diff": "diff --git a/euth/user_management/forms.py b/euth/user_management/forms.py\n--- a/euth/user_management/forms.py\n+++ b/euth/user_management/forms.py\n@@ -15,6 +15,12 @@\n \n     def clean(self):\n         email = self.cleaned_data.get('email')\n+        if email and not User.objects.filter(email=email):\n+            if Registration.objects.filter(email=email):\n+                raise ValidationError(_('account not activated'))\n+            else:\n+                raise ValidationError(_('account doesn\\'t exist'))\n+\n         password = self.cleaned_data.get('password')\n         user = authenticate(username=email, password=password)\n         if not user or not user.is_active:\n@@ -42,7 +48,7 @@\n         password1 = self.cleaned_data.get('password')\n         password2 = self.cleaned_data.get('password_repeat')\n         if password1 != password2:\n-            raise ValidationError(_('passwords dont match'))\n+            raise ValidationError(_('passwords don\\'t match'))\n         return password2\n \n     def clean_username(self):\n@@ -134,8 +140,8 @@\n     def clean_password_repeat(self):\n         password1 = self.cleaned_data.get('password')\n         password2 = self.cleaned_data.get('password_repeat')\n-        if password1 != password2:\n-            raise ValidationError(_('passwords dont match'))\n+        if password1 and password1 != password2:\n+            raise ValidationError(_('passwords don\\'t match'))\n         return password2\n \n     def reset_password(self, request):\n", "issue": "No warning/help text when password entered incorrectly\nWhen I try to log in with the wrong log in details, I don't get a message informing me what didn't work - i.e. wrong password/log in (Firefox, 47 on Mac).\n\n", "before_files": [{"content": "from django import forms\nfrom django.contrib.auth import authenticate, get_user_model\nfrom django.contrib.auth.hashers import make_password\nfrom django.core.exceptions import ValidationError\nfrom django.utils.translation import ugettext as _\n\nfrom .models import Registration, Reset\n\nUser = get_user_model()\n\n\nclass LoginForm(forms.Form):\n    email = forms.EmailField(max_length=255, required=True)\n    password = forms.CharField(widget=forms.PasswordInput, required=True)\n\n    def clean(self):\n        email = self.cleaned_data.get('email')\n        password = self.cleaned_data.get('password')\n        user = authenticate(username=email, password=password)\n        if not user or not user.is_active:\n            raise ValidationError(_('password mismatch'))\n        return self.cleaned_data\n\n    def login(self, request):\n        email = self.cleaned_data.get('email')\n        password = self.cleaned_data.get('password')\n        user = authenticate(username=email, password=password)\n        return user\n\n\nclass RegisterForm(forms.Form):\n    email = forms.EmailField(max_length=255, required=True)\n    username = forms.CharField(max_length=255, required=True)\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        min_length=8,\n        required=True)\n    password_repeat = forms.CharField(\n        widget=forms.PasswordInput, required=True)\n\n    def clean_password_repeat(self):\n        password1 = self.cleaned_data.get('password')\n        password2 = self.cleaned_data.get('password_repeat')\n        if password1 != password2:\n            raise ValidationError(_('passwords dont match'))\n        return password2\n\n    def clean_username(self):\n        username = self.cleaned_data.get('username')\n        user_exists = User.objects.filter(\n            username=username).first() is not None\n        register_exits = Registration.objects.filter(\n            username=username).first() is not None\n\n        if user_exists or register_exits:\n            raise ValidationError(_('username taken'))\n        return username\n\n    def clean_email(self):\n        email = self.cleaned_data.get('email')\n        user_exists = User.objects.filter(email=email).first()\n        register_exists = Registration.objects.filter(email=email).first()\n        if user_exists or register_exists:\n            raise ValidationError(_('email in use'))\n        return email\n\n    def register(self, request):\n        username = self.cleaned_data.get('username')\n        password = self.cleaned_data.get('password')\n        email = self.cleaned_data.get('email')\n        registration = Registration(username=username,\n                                    email=email,\n                                    password=make_password(password))\n        return registration\n\n\nclass ActivateForm(forms.Form):\n    token = forms.UUIDField(widget=forms.HiddenInput(), required=True)\n\n    def clean_token(self):\n        token = self.cleaned_data.get('token')\n        registration = Registration.objects.filter(token=token).first()\n        if not registration:\n            raise ValidationError(_('invalid token'))\n        else:\n            self.cleaned_data['registration'] = registration\n        return token\n\n    def activate(self, request):\n        registration = self.cleaned_data.get('registration')\n        user = User(username=registration.username,\n                    email=registration.email,\n                    password=registration.password)\n        return user, registration\n\n\nclass RequestResetForm(forms.Form):\n    username_or_email = forms.CharField(max_length=255)\n\n    def clean_username_or_email(self):\n        username_or_email = self.cleaned_data.get('username_or_email')\n        user = (User.objects.filter(username=username_or_email).first() or\n                User.objects.filter(email=username_or_email).first())\n        if not user:\n            raise ValidationError(_('unkown user'))\n        else:\n            self.cleaned_data['user'] = user\n            return username_or_email\n\n    def request_reset(self, request):\n        user = self.cleaned_data.get('user')\n        return Reset(user=user)\n\n\nclass ResetForm(forms.Form):\n    token = forms.UUIDField(widget=forms.HiddenInput(), required=True)\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        min_length=8,\n        required=True)\n    password_repeat = forms.CharField(\n        widget=forms.PasswordInput,\n        required=True)\n\n    def clean_token(self):\n        token = self.cleaned_data.get('token')\n        reset = Reset.objects.filter(token=token).first()\n        if not reset:\n            ValidationError(_('invalid token'))\n        else:\n            self.cleaned_data['reset'] = reset\n        return token\n\n    def clean_password_repeat(self):\n        password1 = self.cleaned_data.get('password')\n        password2 = self.cleaned_data.get('password_repeat')\n        if password1 != password2:\n            raise ValidationError(_('passwords dont match'))\n        return password2\n\n    def reset_password(self, request):\n        reset = self.cleaned_data.get('reset')\n        password = self.cleaned_data.get('password')\n        user = reset.user\n        user.password = make_password(password)\n        return user, reset\n", "path": "euth/user_management/forms.py"}], "after_files": [{"content": "from django import forms\nfrom django.contrib.auth import authenticate, get_user_model\nfrom django.contrib.auth.hashers import make_password\nfrom django.core.exceptions import ValidationError\nfrom django.utils.translation import ugettext as _\n\nfrom .models import Registration, Reset\n\nUser = get_user_model()\n\n\nclass LoginForm(forms.Form):\n    email = forms.EmailField(max_length=255, required=True)\n    password = forms.CharField(widget=forms.PasswordInput, required=True)\n\n    def clean(self):\n        email = self.cleaned_data.get('email')\n        if email and not User.objects.filter(email=email):\n            if Registration.objects.filter(email=email):\n                raise ValidationError(_('account not activated'))\n            else:\n                raise ValidationError(_('account doesn\\'t exist'))\n\n        password = self.cleaned_data.get('password')\n        user = authenticate(username=email, password=password)\n        if not user or not user.is_active:\n            raise ValidationError(_('password mismatch'))\n        return self.cleaned_data\n\n    def login(self, request):\n        email = self.cleaned_data.get('email')\n        password = self.cleaned_data.get('password')\n        user = authenticate(username=email, password=password)\n        return user\n\n\nclass RegisterForm(forms.Form):\n    email = forms.EmailField(max_length=255, required=True)\n    username = forms.CharField(max_length=255, required=True)\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        min_length=8,\n        required=True)\n    password_repeat = forms.CharField(\n        widget=forms.PasswordInput, required=True)\n\n    def clean_password_repeat(self):\n        password1 = self.cleaned_data.get('password')\n        password2 = self.cleaned_data.get('password_repeat')\n        if password1 != password2:\n            raise ValidationError(_('passwords don\\'t match'))\n        return password2\n\n    def clean_username(self):\n        username = self.cleaned_data.get('username')\n        user_exists = User.objects.filter(\n            username=username).first() is not None\n        register_exits = Registration.objects.filter(\n            username=username).first() is not None\n\n        if user_exists or register_exits:\n            raise ValidationError(_('username taken'))\n        return username\n\n    def clean_email(self):\n        email = self.cleaned_data.get('email')\n        user_exists = User.objects.filter(email=email).first()\n        register_exists = Registration.objects.filter(email=email).first()\n        if user_exists or register_exists:\n            raise ValidationError(_('email in use'))\n        return email\n\n    def register(self, request):\n        username = self.cleaned_data.get('username')\n        password = self.cleaned_data.get('password')\n        email = self.cleaned_data.get('email')\n        registration = Registration(username=username,\n                                    email=email,\n                                    password=make_password(password))\n        return registration\n\n\nclass ActivateForm(forms.Form):\n    token = forms.UUIDField(widget=forms.HiddenInput(), required=True)\n\n    def clean_token(self):\n        token = self.cleaned_data.get('token')\n        registration = Registration.objects.filter(token=token).first()\n        if not registration:\n            raise ValidationError(_('invalid token'))\n        else:\n            self.cleaned_data['registration'] = registration\n        return token\n\n    def activate(self, request):\n        registration = self.cleaned_data.get('registration')\n        user = User(username=registration.username,\n                    email=registration.email,\n                    password=registration.password)\n        return user, registration\n\n\nclass RequestResetForm(forms.Form):\n    username_or_email = forms.CharField(max_length=255)\n\n    def clean_username_or_email(self):\n        username_or_email = self.cleaned_data.get('username_or_email')\n        user = (User.objects.filter(username=username_or_email).first() or\n                User.objects.filter(email=username_or_email).first())\n        if not user:\n            raise ValidationError(_('unkown user'))\n        else:\n            self.cleaned_data['user'] = user\n            return username_or_email\n\n    def request_reset(self, request):\n        user = self.cleaned_data.get('user')\n        return Reset(user=user)\n\n\nclass ResetForm(forms.Form):\n    token = forms.UUIDField(widget=forms.HiddenInput(), required=True)\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        min_length=8,\n        required=True)\n    password_repeat = forms.CharField(\n        widget=forms.PasswordInput,\n        required=True)\n\n    def clean_token(self):\n        token = self.cleaned_data.get('token')\n        reset = Reset.objects.filter(token=token).first()\n        if not reset:\n            ValidationError(_('invalid token'))\n        else:\n            self.cleaned_data['reset'] = reset\n        return token\n\n    def clean_password_repeat(self):\n        password1 = self.cleaned_data.get('password')\n        password2 = self.cleaned_data.get('password_repeat')\n        if password1 and password1 != password2:\n            raise ValidationError(_('passwords don\\'t match'))\n        return password2\n\n    def reset_password(self, request):\n        reset = self.cleaned_data.get('reset')\n        password = self.cleaned_data.get('password')\n        user = reset.user\n        user.password = make_password(password)\n        return user, reset\n", "path": "euth/user_management/forms.py"}]}