Beispiel #1
0
def pin_change_do(Req):
    if not Req.user.is_authenticated():
        return denied(Req)

    Form = PinChangeForm(Req.POST, user=Req.user)
    Dict = {}

    if Form.is_valid():
        pin_name = settings.ROOT_PATH + "pins_images/pin_%i.png" % (
            Req.user.id)
        (Letters, Value) = pin(pin_name)
        i = None
        try:
            i = PinsImages.objects.get(user=Req.user)
        except PinsImages.DoesNotExist:
            i = PinsImages(user=Req.user, img=pin_name)

        i.req_vocabulary = Letters
        i.hash_value = generate_key_from(Value, settings.PIN_SALT)
        i.operator = Req.user
        i.status = "created"
        i.save()
        ##устанавливаем холд на вывод
        Key = start_show_pin(Req.user.id, 160000)
        return redirect("/pin_image_page/%s" % (Key))
    else:
        t = loader.get_template("simple_form.html")
        Dict = {}
        Dict["form"] = Form.as_p()
        Dict["action"] = "/profile/pin_change_do"
        Dict["action_title"] = settings.pin_change_title
        Dict["pin_load"] = True
        return http_tmpl_context(Req, t, Dict)
Beispiel #2
0
def pin_change(Req):
    if not Req.user.is_authenticated():
        return denied(Req)

    t = loader.get_template("pin_form_working.html")
    Form = PinChangeForm(user=Req.user)
    Dict = {}
    Dict["title"] = crypton.my_messages.pin_reset_form_title
    Dict["form"] = Form.as_p()
    Dict["action"] = "/profile/pin_change_do"
    Dict["action_title"] = settings.pin_change_title
    Dict["pin_load"] = True
    return http_tmpl_context(Req, t, Dict)