WEB/Django concept

[Django][Authentication System1] 로그인 == 세션을 만드는 과정

bay07 2024. 4. 20. 13:15

▶ Login 로그인 

Session을 Create 하는 과정

 

AuthenticationForm()

로그인 인증에 사용할 데이터를 입력받는 built-in form 

 

* Github 참고 

https://github.com/django/django/blob/main/django/contrib/auth/forms.py#L286

 

django/django/contrib/auth/forms.py at main · django/django

The Web framework for perfectionists with deadlines. - django/django

github.com


로그인 페이지 작성 


▶ login(request, user)

AuthenticationForm을 통해 

인증된 사용자를 로그인하는 함수  

 

▶ get_user()

AuthenticationForm의 인스턴스 매서드 

-> 유효성 검사를 통과했을 경우, 로그인 한 사용자 객체를 반환한다 

 

*Github 참고

https://github.com/django/django/blob/main/django/contrib/auth/forms.py#L356

 

django/django/contrib/auth/forms.py at main · django/django

The Web framework for perfectionists with deadlines. - django/django

github.com


▶ 세션 데이터 확인하기

1. django_session 테이블에서 확인하기 

2. 브라우저에서 확인하기 

개발자도구 - Application - Cookies 


▶ 로그인 링크 작성