Exemple #1
0
def login(request, response):
    form = AuthenticationForm(request.REQUEST)
    if form.is_valid():
        user = form.get_user()
        _login(request, user)
        if form.cleaned_data['remberme']:
            store_login_cookie(response, user)
    else:
        assert AjaxError(form.errors)
Exemple #2
0
def login(request, response):
    form = AuthenticationForm(request.REQUEST)
    if form.is_valid():
        user = form.get_user()
        _login(request, user)
        if form.cleaned_data["remberme"]:
            store_login_cookie(response, user)
    else:
        assert AjaxError(form.errors)
Exemple #3
0
def login(request):
    if request.is_post():
        form = AuthenticationForm(request.POST)
        if form.is_valid():
            user = form.get_user()
            next = request.REQUEST.get('next', reverse('account:index'))
            _login(request, user)
            resp = HttpResponseRedirect(next)
            if form.cleaned_data['remberme']:
                store_login_cookie(resp, user)
            return resp
    else:
        form = AuthenticationForm()
    return 'account/login.html', locals()
Exemple #4
0
def login(request):
    if request.is_post():
        form = AuthenticationForm(request.POST)
        if form.is_valid():
            user = form.get_user()
            next = request.REQUEST.get("next", reverse("account:index"))
            _login(request, user)
            resp = HttpResponseRedirect(next)
            if form.cleaned_data["remberme"]:
                store_login_cookie(resp, user)
            return resp
    else:
        form = AuthenticationForm()
    return "account/login.html", locals()