Skip to main content

login

Persist a user id and a backend in the request. This way a user doesn't have to reauthenticate on every request. Note that data set during the anonymous session is retained when the user logs in.

def login(
request: HttpRequest,
user: User,
backend: str = None
) - > null

Persist a user id and a backend in the request. This way a user doesn't have to reauthenticate on every request. Note that data set during the anonymous session is retained when the user logs in.

Parameters

NameTypeDescription
requestHttpRequestThe current web request object containing the session to be updated
userUserThe authenticated user instance to log into the current session
backendstr = NoneThe dotted import path of the authentication backend used to authenticate the user

Returns

TypeDescription
nullNone