Exemplo n.º 1
0
def index(request):
    form = PasswordResetForm(request)
    if request.is_post():
        captcha = CaptchaForm(request.session, data=request.POST)
        if captcha.is_valid():
            form = PasswordResetForm(request, data=request.POST)
            if form.is_valid():
                form.save()
    else:
        captcha = CaptchaForm(request.session)
    return 'account/forgot/index.html', locals()
Exemplo n.º 2
0
def index(request):
    form = PasswordResetForm(request)
    if request.is_post():
        captcha = CaptchaForm(request.session, data=request.POST)
        if captcha.is_valid():
            form = PasswordResetForm(request, data=request.POST)
            if form.is_valid():
                form.save()
    else:
        captcha = CaptchaForm(request.session)
    return 'account/forgot/index.html', locals()
Exemplo n.º 3
0
def download(request, id):
    book = get_object_or_404(Book.objects.select_related('subarea','category'), id=id)
    subarea = book.subarea
    category = book.category
    key = None
    if request.is_post():
        form = CaptchaForm(request.session, data=request.POST)
        if form.is_valid():
            key = make_download_key(book.id, request.session.session_key)
    else:
        form = CaptchaForm(request.session)
    return 'book/download.html', locals()
Exemplo n.º 4
0
def download(request, id):
    book = get_object_or_404(Book.objects.select_related(
        'subarea', 'category'),
                             id=id)
    subarea = book.subarea
    category = book.category
    key = None
    if request.is_post():
        form = CaptchaForm(request.session, data=request.POST)
        if form.is_valid():
            key = make_download_key(book.id, request.session.session_key)
    else:
        form = CaptchaForm(request.session)
    return 'book/download.html', locals()
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
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()