Sent from my iPhone
On 30-Jul-2023, at 10:45 AM, Abdulrahman Abbas <abdouliabbas75@gmail.com> wrote:
Can you login with superuser?--On Sun, Jul 30, 2023, 02:32 Mh Limon <mhlimon571@gmail.com> wrote:Views.py filefrom django.shortcuts import render,HttpResponse,redirectfrom .models import registrationfrom django.contrib.auth import authenticate,logindef home(request):return render(request,'home.html')def log_in(request):if request.method == 'POST':username = request.POST.get('username')password = request.POST.get('password')user = authenticate(request, username=username, password=password)if user is not None:login(request, user)return redirect('home')else:return HttpResponse("You have incorrect Username or password")return render(request, 'log_in.html')def sign_up(request):if request.method == 'POST':name = request.POST.get('fullname')username = request.POST.get('username')email = request.POST.get('email')pass1 = request.POST.get('password')pass2 = request.POST.get('confirm_password')if pass1 != pass2:return HttpResponse("Password not matched")else:db = registration()db.Name = namedb.username = usernamedb.Email = emaildb.Password = pass1db.save()return redirect('log_in')return render(request,'sign_up.html')This is models.py for sqlite database:
from django.db import modelsclass registration(models.Model):Name = models.CharField(max_length=100)username = models.CharField(max_length=100)Email = models.CharField(max_length=100)Password = models.CharField(max_length=100)
when providing the correct username and password, the system consistently displays an error message stating "You have incorrect Username or password."
please help me to solve this error.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4003937f-9045-4cea-bd6c-b071d7b1a6c3n%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGGqo0MMu55nqSSKhW2%2BjGgGCGf62JJoBuCZA2wgK3NONCxzCg%40mail.gmail.com.
No comments:
Post a Comment