コード例 #1
0
ファイル: views.py プロジェクト: markh-bz/webpay
def verify(request):
    form = forms.VerifyPinForm()
    if utils.pin_recently_entered(request):
        return http.HttpResponseRedirect(get_payment_url())

    if request.method == 'POST':
        form = forms.VerifyPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            request.session['last_pin_success'] = datetime.now()
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Enter Pin'),
                  'action': reverse('pin.verify')})
コード例 #2
0
ファイル: views.py プロジェクト: cvan/webpay
def verify(request):
    form = forms.VerifyPinForm()
    if request.method == "POST":
        form = forms.VerifyPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, "pin/verify.html", {"form": form})
コード例 #3
0
ファイル: test_views.py プロジェクト: AltisCorp/webpay
 def test_recently_entered_pin_redirect(self, get_price, get_secret):
     get_secret.return_value = self.secret
     self.session['last_pin_success'] = datetime.now()
     self.session.save()
     payload = self.request(iss=self.key, app_secret=self.secret)
     res = self.get(payload)
     eq_(res.status_code, 302)
     assert res['Location'].endswith(get_payment_url())
コード例 #4
0
ファイル: views.py プロジェクト: potch/webpay
def verify(request):
    form = forms.VerifyPinForm()
    # pin_recently_entered is on the form because the template expect it as it
    # is rendered from pay.lobby as well as here.
    form.pin_recently_entered = utils.pin_recently_entered(request)
    if form.pin_recently_entered:
        return http.HttpResponseRedirect(get_payment_url())

    if request.method == 'POST':
        form = forms.VerifyPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            request.session['last_pin_success'] = datetime.now()
            return http.HttpResponseRedirect(get_payment_url())
        form.pin_recently_entered = False
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Enter your PIN:'),
                  'action': reverse('pin.verify') })
コード例 #5
0
ファイル: test_views.py プロジェクト: markh-bz/webpay
 def test_pin_recently_entered(self):
     self.request.session['last_pin_success'] = datetime.now()
     self.request.session.save()
     # If they get the bypass prompt then there
     # will be no data posted to the view.
     res = self.client.post(self.url)
     eq_(res.status_code, 302)
     assert res.get('Location', '').endswith(get_payment_url())
コード例 #6
0
ファイル: views.py プロジェクト: potch/webpay
def confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ConfirmPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, 'pin/pin_form.html', { 'form': form,
                  'title': _('Confirm your PIN:'),
                  'action': reverse('pin.confirm') })
コード例 #7
0
ファイル: test_views.py プロジェクト: koehlermichael/webpay
 def test_recently_entered_pin_redirect(self, update_session, get_price, get_active_product):
     self.set_secret(get_active_product)
     self.session["uuid"] = "something"
     self.session["last_pin_success"] = datetime.now()
     self.save_session()
     payload = self.request(iss=self.key, app_secret=self.secret)
     res = self.get(payload)
     eq_(res.status_code, 302)
     assert res["Location"].endswith("?next={0}".format(get_payment_url(mock.Mock()))), res["Location"]
コード例 #8
0
ファイル: views.py プロジェクト: cvan/webpay
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == "POST":
        form = forms.ResetConfirmPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, "pin/reset_confirm.html", {"form": form})
コード例 #9
0
ファイル: test_views.py プロジェクト: selimsumlu/webpay
 def test_recently_entered_pin_redirect(self, update_session, get_price,
                                        get_active_product):
     self.set_secret(get_active_product)
     self.session['uuid'] = 'something'
     self.session['last_pin_success'] = datetime.now()
     self.save_session()
     payload = self.request(iss=self.key, app_secret=self.secret)
     res = self.get(payload)
     eq_(res.status_code, 302)
     assert res['Location'].endswith(get_payment_url(mock.Mock()))
コード例 #10
0
ファイル: views.py プロジェクト: lonnen/webpay
def verify(request):
    form = forms.VerifyPinForm()
    if request.method == 'POST':
        # TODO(Wraithan): Get the buyer's UUID once identity is figured out
        # with webpay.
        stub_uuid = 'dat:uuid'
        form = forms.VerifyPinForm(uuid=stub_uuid, data=request.POST)
        if form.is_valid():
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, 'pin/verify.html', {'form': form})
コード例 #11
0
ファイル: test_views.py プロジェクト: ferjm/webpay
 def test_recently_entered_pin_redirect(self, update_session, get_price,
                                        get_active_product):
     self.set_secret(get_active_product)
     self.session['uuid'] = 'something'
     self.session['last_pin_success'] = datetime.now()
     self.session.save()
     payload = self.request(iss=self.key, app_secret=self.secret)
     res = self.get(payload)
     eq_(res.status_code, 302)
     assert res['Location'].endswith(get_payment_url())
コード例 #12
0
def confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ConfirmPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            set_user_has_confirmed_pin(request, True)
            return http.HttpResponseRedirect(get_payment_url(request))
    form.no_pin = True
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm Pin'),
                  'action': reverse('pin.confirm')})
コード例 #13
0
ファイル: views.py プロジェクト: ferjm/webpay
def verify(request):
    form = forms.VerifyPinForm()

    if request.method == 'POST':
        form = forms.VerifyPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            request.session['last_pin_success'] = datetime.now()
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, 'pin/pin_form.html', {
        'form': form,
        'title': _('Enter Pin'),
        'action': reverse('pin.verify')
    })
コード例 #14
0
ファイル: views.py プロジェクト: potch/webpay
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ResetConfirmPinForm(uuid=get_user(request),
                                         data=request.POST)
        if form.is_valid():
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url())
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm your new PIN:'),
                  'action': reverse('pin.reset_confirm') })
コード例 #15
0
ファイル: views.py プロジェクト: hseagle2015/webpay
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ResetConfirmPinForm(uuid=get_user(request),
                                         data=request.POST)
        if form.is_valid():
            # Clear reverification state since this PIN reset is finished.
            request.session['was_reverified'] = False
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url())
    form.reset_flow = True
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm Pin'),
                  'action': reverse('pin.reset_confirm')})
コード例 #16
0
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ResetConfirmPinForm(uuid=get_user(request),
                                         data=request.POST)
        if form.is_valid():
            # Clear reverification state since this PIN reset is finished.
            request.session['was_reverified'] = False
            messages.success(request, _('Pin reset'))
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url(request))
    form.reset_flow = True
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm Pin'),
                  'action': reverse('pin.reset_confirm')})
コード例 #17
0
ファイル: views.py プロジェクト: ferjm/webpay
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ResetConfirmPinForm(uuid=get_user(request),
                                         data=request.POST)
        if form.is_valid():
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url())
    form.reset_flow = True
    return render(
        request, 'pin/pin_form.html', {
            'form': form,
            'title': _('Confirm Pin'),
            'action': reverse('pin.reset_confirm')
        })
コード例 #18
0
ファイル: views.py プロジェクト: Kodextor/webpay
def confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ConfirmPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            set_user_has_confirmed_pin(request, True)
            return http.HttpResponseRedirect(get_payment_url(request))
    form.no_pin = True
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm Pin'),
                  'action': reverse('pin.confirm'),
                  'pin_form_tracking' : {
                    'pin_error_codes': form.pin_error_codes,
                  },
                  'track_cancel': {
                      'action': 'pin cancel',
                      'label': 'Confirm Pin Page',
                  }})
コード例 #19
0
ファイル: utils.py プロジェクト: Chiara-De-Liberato/webpay
def check_pin_status(request):
    if request.session.get('uuid_pin_is_locked'):
        return reverse('pin.is_locked')

    if request.session.get('uuid_pin_was_locked'):
        return reverse('pin.was_locked')

    last_success = request.session.get('last_pin_success')
    if (last_success and ((datetime.now() - last_success).seconds <
                          settings.PIN_UNLOCK_LENGTH)):
        return get_payment_url(request)

    if request.session.get('uuid_has_pin'):
        if request.session.get('uuid_has_confirmed_pin'):
            return None
        else:
            client.change_pin(request.session['uuid'], None)
            request.session['uuid_has_pin'] = False
    return reverse('pin.create')
コード例 #20
0
ファイル: utils.py プロジェクト: ferjm/webpay
def check_pin_status(request):
    if request.session.get('uuid_pin_is_locked'):
        return reverse('pin.is_locked')

    if request.session.get('uuid_pin_was_locked'):
        return reverse('pin.was_locked')

    last_success = request.session.get('last_pin_success')
    if (last_success and (
        (datetime.now() - last_success).seconds < settings.PIN_UNLOCK_LENGTH)):
        return get_payment_url()

    if request.session.get('uuid_has_pin'):
        if request.session.get('uuid_has_confirmed_pin'):
            return None
        else:
            client.change_pin(request.session['uuid'], None)
            request.session['uuid_has_pin'] = False
    return reverse('pin.create')
コード例 #21
0
ファイル: views.py プロジェクト: Kodextor/webpay
def verify(request):
    form = forms.VerifyPinForm()

    if request.method == 'POST':
        form = forms.VerifyPinForm(uuid=get_user(request), data=request.POST)
        if form.is_valid():
            request.session['last_pin_success'] = datetime.now()
            return http.HttpResponseRedirect(get_payment_url(request))
        elif form.pin_is_locked:
            request.session['uuid_pin_is_locked'] = True
            return http.HttpResponseRedirect(reverse('pin.is_locked'))
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Enter Pin'),
                  'action': reverse('pin.verify'),
                  'pin_form_tracking' : {
                    'pin_error_codes': form.pin_error_codes,
                  },
                  'track_cancel': {
                      'action': 'pin cancel',
                      'label': 'Verify Pin Page',
                  }})
コード例 #22
0
ファイル: utils.py プロジェクト: Kodextor/webpay
def check_pin_status(request):
    if request.session.get('uuid_pin_is_locked'):
        return reverse('pin.is_locked')

    if request.session.get('uuid_pin_was_locked'):
        return reverse('pin.was_locked')

    last_success = request.session.get('last_pin_success')
    if (last_success and ((datetime.now() - last_success).seconds <
                          settings.PIN_UNLOCK_LENGTH)):
        return get_payment_url(request)

    if request.session.get('uuid_has_pin'):
        if request.session.get('uuid_has_confirmed_pin'):
            return None
        else:
            try:
                client.change_pin(request.session['uuid'], None)
            except ResourceModified:
                return system_error(request, code=msg.RESOURCE_MODIFIED)
            request.session['uuid_has_pin'] = False
    return reverse('pin.create')
コード例 #23
0
ファイル: views.py プロジェクト: Kodextor/webpay
def reset_confirm(request):
    form = forms.ConfirmPinForm()
    if request.method == 'POST':
        form = forms.ResetConfirmPinForm(uuid=get_user(request),
                                         data=request.POST)
        if form.is_valid():
            # Clear reverification state since this PIN reset is finished.
            request.session['was_reverified'] = False
            messages.success(request, _('Pin reset'))
            # Copy pin into place is handled in solitude, webpay
            # merely asked solitude to verify the new pin which
            # happens in validation of the form.
            return http.HttpResponseRedirect(get_payment_url(request))
    form.reset_flow = True
    return render(request, 'pin/pin_form.html', {'form': form,
                  'title': _('Confirm Pin'),
                  'action': reverse('pin.reset_confirm'),
                  'pin_form_tracking' : {
                      'pin_error_codes': form.pin_error_codes,
                  },
                  'track_cancel': {
                      'action': 'pin cancel',
                      'label': 'Reset Pin page',
                  }})
コード例 #24
0
 def test_good_pin(self):
     res = self.client.post(self.url, data={'pin': '1234'})
     assert res['Location'].endswith(get_payment_url(Mock()))
     # Make sure the reverification flag was cleared out.
     eq_(res.client.session['was_reverified'], False)
コード例 #25
0
 def test_good_pin(self, set_user_has_confirmed_pin):
     res = self.client.post(self.url, data={'pin': '1234'})
     set_user_has_confirmed_pin.assert_called_with(ANY, True)
     assert res['Location'].endswith(get_payment_url(Mock()))
コード例 #26
0
ファイル: test_views.py プロジェクト: markh-bz/webpay
 def test_good_pin(self):
     res = self.client.post(self.url, data={'pin': '1234'})
     assert res['Location'].endswith(get_payment_url())
コード例 #27
0
ファイル: test_utils.py プロジェクト: ferjm/webpay
 def test_pin_recently_entered_successfully(self):
     self.request.session['last_pin_success'] = datetime.now()
     eq_(utils.check_pin_status(self.request), get_payment_url())
コード例 #28
0
 def test_pin_recently_entered_successfully(self):
     self.request.session['last_pin_success'] = datetime.now()
     eq_(utils.check_pin_status(self.request),
         get_payment_url(mock.Mock()))
コード例 #29
0
 def test_good_pin(self, set_user_has_confirmed_pin):
     res = self.client.post(self.url, data={'pin': '1234'})
     set_user_has_confirmed_pin.assert_called_with(ANY, True)
     assert res['Location'].endswith(get_payment_url(Mock()))
コード例 #30
0
 def test_good_pin(self):
     res = self.client.post(self.url, data={'pin': '1234'})
     assert res['Location'].endswith(get_payment_url(Mock()))
     # Make sure the reverification flag was cleared out.
     eq_(res.client.session['was_reverified'], False)
コード例 #31
0
 def test_good_pin(self):
     res = self.client.post(self.url, data={'pin': '1234'})
     assert res['Location'].endswith(get_payment_url(Mock()))
コード例 #32
0
ファイル: test_views.py プロジェクト: hseagle2015/webpay
 def test_good_pin(self, set_user_has_confirmed_pin):
     res = self.client.post(self.url, data={"pin": "1234"})
     set_user_has_confirmed_pin.assert_called_with(ANY, True)
     assert res["Location"].endswith(get_payment_url())
コード例 #33
0
ファイル: test_views.py プロジェクト: lonnen/webpay
 def test_good_pin(self):
     res = self.client.post(self.url, data={'pin': '1234'})
     self.assertRedirects(res, get_payment_url())
コード例 #34
0
ファイル: test_views.py プロジェクト: hseagle2015/webpay
 def test_good_pin(self):
     res = self.client.post(self.url, data={"pin": "1234"})
     assert res["Location"].endswith(get_payment_url())
     # Make sure the reverification flag was cleared out.
     eq_(res.client.session["was_reverified"], False)
コード例 #35
0
ファイル: test_views.py プロジェクト: hseagle2015/webpay
 def test_good_pin(self):
     res = self.client.post(self.url, data={"pin": "1234"})
     assert res["Location"].endswith(get_payment_url())