ValueError at /login invalid salt
I am creating a django app and have run in to a problem with the login portion of it. Everything seems to be working fine but when I login in with the stored information I receive the ValueError with invalid salt. I've looked on here for solutions but nothing seems to be doing the trick. I tried using the encode('utf-8) solution but that doesn't work either.
def login(request): if request.method != 'POST': return redirect('/')
user = User.objects.filter(email = request.POST.get('email')).first()
if user and bcrypt.checkpw(request.POST.get('password').encode(), user.password.encode()):
request.session['user_id'] = user.id
return redirect('/quotes')
else:
messages.add_message(request, messages.INFO, 'invalid credentials', extra_tags="login")
return redirect('/')
return redirect('/quotes')
The issue seems to stem around the if user and bcrypt.checkpw() but I don't know what to do different?