Django Development: Chrome warns "Change Password"

Viewed 758

im new at django and for learning i create a fantasy project. By testing my website i was been warned from my Chrome browser that i should change my password. The exact message is

Due to a data breach on a website or in an app your password was disclosed. Chrome recommends changing your password to 127.0.0.1:8000.

is there anything in my code that makes this data breach?

Thanks for helping!

forms.py

class RegisterForm(forms.Form):

username = forms.CharField(
    label='Benutzername',
    max_length=150,
    required=True,
    widget=forms.TextInput(
        attrs={
            'placeholder': 'Username',
        }
    )
)

email = forms.EmailField(
    label='E-Mail Adresse',
    max_length=254,
    required=True,
    widget=forms.EmailInput(
        attrs={
            'placeholder': 'email@exapmle.com',
        }
    )
)

password = forms.CharField(
    label='Passwort',
    max_length=254,
    required=True,
    widget=forms.PasswordInput(
        attrs={
            'placeholder': 'Password',
        }
    )
)

repeatPassword = forms.CharField(
    label='Passwort wiederholen',
    max_length=254, required=True,
    widget=forms.PasswordInput(
        attrs={
            'placeholder': 'Password',
        }
    )
)

name = forms.CharField(
    label='Nachname',
    max_length=150,
    required=False,
    widget=forms.TextInput(
        attrs={
            'placeholder': 'Last Name',
        }
    )
)

firstName = forms.CharField(
    label='Vorname',
    max_length=150,
    required=False,
    widget=forms.TextInput(
        attrs={
            'placeholder': 'First name',
        }
    )
)

def clean(self):
    cleaned_data = super(RegisterForm, self).clean()
    username = cleaned_data.get('username')
    email = cleaned_data.get('email')
    password = cleaned_data.get('password')
    repeatPassword = cleaned_data.get('repeatPassword')
    name = cleaned_data.get('name')
    firstName = cleaned_data.get('firstName')

    if not username:
        raise forms.ValidationError('Enter Username')

    if User.objects.filter(username=username).exists():
        raise forms.ValidationError("Username is taken by another one")

    if not email:
        raise forms.ValidationError('Enter E-Mail')

    if User.objects.filter(email=email).exists():
        raise forms.ValidationError("E-Mail is taken by another one")

    if not password:
        raise forms.ValidationError('Enter password')

    if not repeatPassword:
        raise forms.ValidationError('Repeat password')

    if password != repeatPassword:
        raise forms.ValidationError('Passwords are not equal')

views.py

def register_view(request):
if request.method == 'POST':
    form = RegisterForm(request.POST)
    if form.is_valid():
        user = User.objects.create_user(username=request.POST['username'], email=request.POST['email'],
                                        password=request.POST['password'], first_name=request.POST['firstName'],
                                        last_name=request.POST['name'])

        user.save()

        # Get Created User from DB
        user = authenticate(request, username=request.POST['username'], password=request.POST['password'])
        if user:
            # LogIn (create Session etc...)
            login(request, user)

            # open user.html
            return render(request, 'web/user.html')
    return render(request, 'web/register.html', {'form': form})
else:
    form = RegisterForm()
    return render(request, 'web/register.html', {'form': form})
2 Answers

It seems that this message is just an information, that a weak password is used. Thanks to Tenacious B for clarify this.

Your code is fine, Chrome does show such warning when you use a weak password.No need to worry about it.

Related