Exemple #1
0
def do_add_channel(request, data):
    form = AddChannelForm(data)
    if form.is_valid():
        channel = form.save(commit=False)
        channel.user = request.team.user

        # Verify and obtain telegram sender's id
        if channel.kind == "telegram":
            sender_id = channel.retrieve_telegram_id(data)
            if 'er1' == sender_id:
                error = '*Authentication Code was not sent to the Bot, Send the message to the Bot first'
                return add_telegram(request, error)
            elif 'er2' == sender_id:
                error = '*Invalid API token was used, Please Use a valid APi token!'
                return add_telegram(request, error)
            else:
                channel.telegram_id = sender_id
                channel.email_verified = True

        channel.save()
        channel.assign_all_checks()

        if channel.kind == "email":
            channel.send_verify_link()

        return redirect("hc-channels")
    else:
        return HttpResponseBadRequest()
Exemple #2
0
def do_add_channel(request, data):
    form = AddChannelForm(data)
    if form.is_valid():
        channel = form.save(commit=False)
        channel.user = request.team.user
        channel.save()

        channel.assign_all_checks()

        if channel.kind == "email":
            channel.send_verify_link()

        return redirect("hc-channels")
    else:
        return HttpResponseBadRequest()
Exemple #3
0
def do_add_channel(request, data):
    form = AddChannelForm(data)
    if form.is_valid():
        channel = form.save(commit=False)
        channel.user = request.team.user
        channel.save()

        channel.assign_all_checks()

        if channel.kind == "email":
            channel.send_verify_link()

        return redirect("hc-channels")
    else:
        return HttpResponseBadRequest()
Exemple #4
0
def do_add_channel(request, data):
    form = AddChannelForm(data)
    if form.is_valid():
        channel = form.save(commit=False)
        channel.user = request.user
        channel.save()

        checks = Check.objects.filter(user=request.user)
        channel.checks.add(*checks)

        if channel.kind == "email":
            channel.send_verify_link()

        return redirect("hc-channels")
    else:
        return HttpResponseBadRequest()
Exemple #5
0
def do_add_channel(request, data):
    form = AddChannelForm(data)
    if form.is_valid():
        channel = form.save(commit=False)
        channel.user = request.user
        channel.save()

        checks = Check.objects.filter(user=request.user)
        channel.checks.add(*checks)

        if channel.kind == "email":
            channel.send_verify_link()

        return redirect("hc-channels")
    else:
        return HttpResponseBadRequest()