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)
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)
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()
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()
def register(request): if request.user.is_authenticated(): return 'account/registered.html', locals() if request.is_post(): captcha = CaptchaForm(request.session, data=request.POST) form = RegisterForm(request.POST) if captcha.is_valid() and form.is_valid(): user = form.save() _login(request, user) return 'account/register_done.html', locals() else: captcha = CaptchaForm(request.session) form = RegisterForm() return 'account/register.html', locals()
def register(request): if request.user.is_authenticated(): return "account/registered.html", locals() if request.is_post(): captcha = CaptchaForm(request.session, data=request.POST) form = RegisterForm(request.POST) if captcha.is_valid() and form.is_valid(): user = form.save() _login(request, user) return "account/register_done.html", locals() else: captcha = CaptchaForm(request.session) form = RegisterForm() return "account/register.html", locals()