def create(request): form = forms.CreatePinForm() if request.method == 'POST': form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): if getattr(form, 'buyer_exists', False): try: res = client.change_pin(form.uuid, form.cleaned_data['pin'], etag=form.buyer_etag) except ResourceModified: return system_error(request, code=msg.RESOURCE_MODIFIED) else: res = client.create_buyer(form.uuid, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse('pin.confirm')) form.no_pin = True return render(request, 'pin/pin_form.html', {'form': form, 'title': _('Create a Pin'), 'action': reverse('pin.create'), 'pin_form_tracking' : { 'pin_error_codes': form.pin_error_codes, }, 'track_cancel': { 'action': 'pin cancel', 'label': 'Create Pin Page', }})
def create(request): form = forms.CreatePinForm() if request.method == 'POST': form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): if getattr(form, 'buyer_exists', False): try: res = client.change_pin(form.uuid, form.cleaned_data['pin'], etag=form.buyer_etag) except ResourceModified: return system_error(request, code=msg.RESOURCE_MODIFIED) else: res = client.create_buyer(form.uuid, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse('pin.confirm')) form.no_pin = True return render( request, 'pin/pin_form.html', { 'form': form, 'title': _('Create a Pin'), 'action': reverse('pin.create'), 'pin_form_tracking': { 'pin_error_codes': form.pin_error_codes, }, 'track_cancel': { 'action': 'pin cancel', 'label': 'Create Pin Page', } })
def reset_new_pin(request): form = forms.CreatePinForm() if request.method == "POST": form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): res = client.set_new_pin(form.buyer, form.cleaned_data["pin"]) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse("pin.reset_confirm")) return render(request, "pin/reset_create.html", {"form": form})
def reset_new_pin(request): form = forms.CreatePinForm() if request.method == 'POST': form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): res = client.set_new_pin(form.buyer, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse('pin.reset_confirm')) return render(request, 'pin/pin_form.html', {'form': form, 'title': _('Enter your new PIN:'), 'action': reverse('pin.reset_new_pin') })
def create(request): form = forms.CreatePinForm() if request.method == "POST": form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): if hasattr(form, "buyer"): res = client.change_pin(form.buyer, form.cleaned_data["pin"]) else: res = client.create_buyer(form.uuid, form.cleaned_data["pin"]) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse("pin.confirm")) return render(request, "pin/create.html", {"form": form})
def create(self, request): form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA) if form.is_valid(): res = client.change_pin(form.uuid, form.cleaned_data['pin'], etag=form.buyer_etag, pin_confirmed=True, clear_was_locked=True) if form.client_response_is_valid(res): set_user_has_pin(request, True) return response.Response(status=204) return api_error(form, request)
def create(self, request): form = CreatePinForm(uuid=request.session["uuid"], data=request.DATA) if form.is_valid(): if getattr(form, "buyer_exists", None): res = client.change_pin(form.uuid, form.cleaned_data["pin"], etag=form.buyer_etag) else: res = client.create_buyer(form.uuid, form.cleaned_data["pin"]) if form.handle_client_errors(res): set_user_has_pin(request, True) return response.Response(status=201) return response.Response(status=201) return app_error(request)
def create(request): form = forms.CreatePinForm() if request.method == 'POST': form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): if hasattr(form, 'buyer'): res = client.change_pin(form.buyer, form.cleaned_data['pin']) else: res = client.create_buyer(form.uuid, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse('pin.confirm')) return render(request, 'pin/pin_form.html', {'form': form, 'title': _('Create your PIN:'), 'action': reverse('pin.create') })
def create(request): form = forms.CreatePinForm() if request.method == 'POST': form = forms.CreatePinForm(uuid=get_user(request), data=request.POST) if form.is_valid(): if getattr(form, 'buyer_exists', False): res = client.change_pin(form.uuid, form.cleaned_data['pin']) else: res = client.create_buyer(form.uuid, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return http.HttpResponseRedirect(reverse('pin.confirm')) form.no_pin = True return render(request, 'pin/pin_form.html', {'form': form, 'title': _('Create a Pin'), 'action': reverse('pin.create')})
def create(self, request): form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA) if form.is_valid(): if getattr(form, 'buyer_exists', None): res = client.change_pin(form.uuid, form.cleaned_data['pin'], etag=form.buyer_etag) else: res = client.create_buyer(form.uuid, form.cleaned_data['pin']) if form.handle_client_errors(res): set_user_has_pin(request, True) return response.Response(status=201) return response.Response(status=201) return app_error(request)
def create(self, request): form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA) if form.is_valid(): if getattr(form, 'buyer_exists', None): res = client.change_pin(form.uuid, form.cleaned_data['pin'], etag=form.buyer_etag, pin_confirmed=True, clear_was_locked=True) else: res = client.create_buyer(form.uuid, pin=form.cleaned_data['pin'], pin_confirmed=True, email=request.session[ 'logged_in_user']) if form.handle_client_errors(res): set_user_has_pin(request, True) return response.Response(status=204) return app_error(request)