1.django用户验证模块(/django/contrib/auth/__init__.py)
from django.contrib.auth import authenticate, login username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is not None: login(request, user)

本文探讨了在Django中如何实现用户验证,特别是在不知道用户密码的情况下。通过自定义方法,绕过默认的authenticate方法中必须提供password的要求,从而达到指定用户登录的目的。内容引用自https://www.cnblogs.com/wangmin0216/p/7274533.html。
最低0.47元/天 解锁文章
443

被折叠的 条评论
为什么被折叠?



