Exemplo n.º 1
0
def email_login(request):
    """Connect email."""
    captcha = None

    if request.method == 'POST':
        form = EmailForm(request.POST)
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request, form, request.POST)
        if (captcha is None or captcha.is_valid()) and form.is_valid():
            email_user = form.cleaned_data['email_user']
            if email_user and email_user != request.user:
                notify_account_activity(
                    form.cleaned_data['email_user'],
                    request,
                    'connect'
                )
                return fake_email_sent(request)
            store_userid(request)
            return social_complete(request, 'email')
    else:
        form = EmailForm()
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request)

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register email'),
            'form': form,
            'captcha_form': captcha,
        }
    )
Exemplo n.º 2
0
def email_login(request):
    """Connect e-mail."""
    captcha = None

    if request.method == 'POST':
        form = EmailForm(request.POST)
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request, form, request.POST)
        if (captcha is None or captcha.is_valid()) and form.is_valid():
            email_user = form.cleaned_data['email_user']
            if email_user and email_user != request.user:
                AuditLog.objects.create(form.cleaned_data['email_user'],
                                        request, 'connect')
                return fake_email_sent(request)
            store_userid(request)
            return social_complete(request, 'email')
    else:
        form = EmailForm()
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request)

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register e-mail'),
            'form': form,
            'captcha_form': captcha
        },
    )
Exemplo n.º 3
0
def email_login(request):
    """Connect email."""
    captcha = None

    if request.method == 'POST':
        form = EmailForm(request.POST)
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request, form, request.POST)
        if (captcha is None or captcha.is_valid()) and form.is_valid():
            if form.cleaned_data['email_user']:
                notify_account_activity(
                    form.cleaned_data['email_user'],
                    request,
                    'connect'
                )
                request.session['registration-email-sent'] = True
                return redirect('email-sent')
            store_userid(request)
            return complete(request, 'email')
    else:
        form = EmailForm()
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request)

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register email'),
            'form': form,
            'captcha_form': captcha,
        }
    )
Exemplo n.º 4
0
def email_login(request):
    """Connect e-mail."""
    captcha = None

    if request.method == "POST":
        form = EmailForm(request.POST)
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request, form, request.POST)
        if (captcha is None or captcha.is_valid()) and form.is_valid():
            email_user = form.cleaned_data["email_user"]
            if email_user and email_user != request.user:
                AuditLog.objects.create(form.cleaned_data["email_user"],
                                        request, "connect")
                return fake_email_sent(request)
            store_userid(request)
            return social_complete(request, "email")
    else:
        form = EmailForm()
        if settings.REGISTRATION_CAPTCHA:
            captcha = CaptchaForm(request)

    return render(
        request,
        "accounts/email.html",
        {
            "title": _("Register e-mail"),
            "form": form,
            "captcha_form": captcha
        },
    )
Exemplo n.º 5
0
def email_login(request):
    """Connect email."""
    captcha_form = None

    if request.method == 'POST':
        form = EmailForm(request.POST)
        if settings.REGISTRATION_CAPTCHA:
            captcha_form = CaptchaForm(request, request.POST)
        if ((captcha_form is None or captcha_form.is_valid()) and
                form.is_valid()):
            if form.cleaned_data['email_user']:
                notify_account_activity(
                    form.cleaned_data['email_user'],
                    request,
                    'connect'
                )
                request.session['registration-email-sent'] = True
                return redirect('email-sent')
            store_userid(request)
            return complete(request, 'email')
    else:
        form = EmailForm()
        if settings.REGISTRATION_CAPTCHA:
            captcha_form = CaptchaForm(request)

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register email'),
            'form': form,
            'captcha_form': captcha_form,
        }
    )
Exemplo n.º 6
0
def email_login(request):
    """
    Connect email.
    """
    if request.method == "POST":
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, "email")
    else:
        form = EmailForm()

    return render(request, "accounts/email.html", {"title": _("Register email"), "form": form})
Exemplo n.º 7
0
def email_login(request):
    """Connect email."""
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, 'email')
    else:
        form = EmailForm()

    return render(request, 'accounts/email.html', {
        'title': _('Register email'),
        'form': form,
    })
Exemplo n.º 8
0
def email_login(request):
    '''
    Connect email.
    '''
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, 'email')
    else:
        form = EmailForm()

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register email'),
            'form': form,
        }
    )
Exemplo n.º 9
0
def email_login(request):
    '''
    Connect email.
    '''
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, 'email')
    else:
        form = EmailForm()

    return render_to_response(
        'accounts/email.html',
        RequestContext(
            request,
            {
                'title': _('Register email'),
                'form': form,
            }
        )
    )