def login(request, template="accounts/account_login.html",
          form_class=LoginForm, extra_context=None):
    """
    Login form.
    """
    form = form_class(request.POST or None)
    if request.method == "POST" and form.is_valid():
        authenticated_user = form.save()
        info(request, _("Successfully logged in"))
        auth_login(request, authenticated_user)
        return login_redirect(request)
    context = {"form": form, "title": _("Log in")}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
Login form.