2
AllAuth를 사용하여 프로그래밍 방식으로 로그인하는 간단한 방법이 있습니까? 쿠키 또는 세션에 대해별로 신경 쓰지 않고 AllAuth 사용자 계정에 해당하는 Client
을 얻고 싶습니다.Django-AllAuth를 사용하여 프로그래밍 방식으로 로그인 하시겠습니까?
예 :
from django.test import Client
from django.contrib.auth.models import User
user = User.objects.first() # assuming user registered with AllAuth
client.login(username=user.username) # password needed!
AllAuth 사용자 계정은 위의 코드를 작동하지 않도록 암호가 보장되지 않습니다. 그렇다면 어떻게하면 클라이언트가 암호없이 로그인하여 테스트를 쉽게 할 수 있습니까?
겠습니까 ['force_login' (https://docs.djangoproject.com/en/1.10/topics/testing/되어 사용 tools/# django.test.Client.force_login)가 작동합니까? – Alasdair