Re:Cardie – An open source business card designer and sharin...
by nfoert on Wednesday July 31, 2024 @10:11PM
(#41125594)
Yeah you're right, that's definitely not the the most secure. Do you know of a more secure alternative I could try instead?
[ Parent
| on HN ]
Re:Cardie – An open source business card designer and sharin...
by aperezalbela on Wednesday July 31, 2024 @11:13PM
(#41125822)
I'd suggest using forms.Form for a LoginForm containing e.g.
username = forms.CharField(max_length=150) password = forms.CharField(widget=forms.PasswordInput)
and then a view to instantiate form with request.POST (if request.POST) like:
form = LoginForm(request.POST)
and then if form.is_valid() you can clean data using
username = form.cleaned_data['username']
and the same for password.
Then:
user = authenticate(request, username=username, password=password)
and then check if user is not None then login(request, user)
Note that login and authenticate come from django.contrib.auth import authenticate, login
Hope that helps.
Re:Cardie – An open source business card designer and sharin...
by singpolyma3 on Thursday August 01, 2024 @11:58AM
(#41130558)
...how is that more secure?