1👍
✅
Your user creation method is wrong because I assume you are saving user in a plain text.
Two ways…
Method using set_password
Method using create_user
0👍
My working version:
def register(request):
if request.method == 'POST':
user_form = UserForm(request.POST)
if user_form.is_valid():
user = user_form.save()
user.set_password(request.POST['password'])
user.save()
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username,password=password)
user.backend = 'django.contrib.auth.backends.ModelBackend'
login(request, user)
messages.info(request, "Thanks for register!")
return HttpResponseRedirect("/")
- [Answer]-A light weight framework to host HTML files produced
- [Answer]-How to create multiples of same form for user
Source:stackexchange.com