def get(self, request, uidb64, token): try: uid = force_text(urlsafe_base64_decode(uidb64)) user = User.objects.get(pk=uid) except (TypeError, ValueError, OverflowError, ObjectDoesNotExist): user = None if user and user_activation_token.check_token(user, token): user.is_active = True user.save() return redirect(build_frontend_url('login')) else: if user and user.is_active: return redirect(build_frontend_url('login')) else: msg = _('Activation link is invalid!') return HttpResponse(msg, status=404)
def generate_form_paypal(order_id, amount, **kwargs): form_params = { "business": settings.PAYPAL_BUSINESS, "item_name": str(_("Agency membership")), "currency_code": settings.PAYMENT_CURRENCY, "invoice": str(order_id), "notify_url": build_backend_url(reverse('paypal-ipn')), "return": build_frontend_url(settings.PAYPAL_FRONTEND_SUCCESS_URL), "cancel_return": build_frontend_url(settings.PAYPAL_FRONTEND_CANCEL_URL), "no_note": 1, "no_shipping": 1, "amount": amount, } form_params.update(kwargs) return {f.name: f.value() for f in PayPalPaymentsForm(initial=form_params)}
def get(self, request, uidb64, token, email): try: uid = force_text(urlsafe_base64_decode(uidb64)) user = User.objects.get(pk=uid) email = email except (TypeError, ValueError, OverflowError, ObjectDoesNotExist): user = None if user is not None and change_email_token.check_token(user, token): user.email = email user.save() return redirect(build_frontend_url('login')) else: msg = _('Change email link is invalid!') return HttpResponse(msg, status=404)
def build_position_url(pk): return build_frontend_url('/position/{}'.format(str(pk)))
def build_candidate_url(pk): return build_frontend_url('/candidate/{}'.format(str(pk)))