stripe_id = full_json['data']['object']['customer'] try: profile = Profile.objects.get(stripe_id=stripe_id) profile.activate_premium() except Profile.DoesNotExist: return {"code": -1, "message": "User doesn't exist."} zebra_webhook_customer_subscription_created.connect(stripe_signup) def stripe_payment_history_sync(sender, full_json, **kwargs): stripe_id = full_json['data']['object']['customer'] try: profile = Profile.objects.get(stripe_id=stripe_id) profile.setup_premium_history() except Profile.DoesNotExist: return {"code": -1, "message": "User doesn't exist."} zebra_webhook_charge_succeeded.connect(stripe_payment_history_sync) def change_password(user, old_password, new_password, only_check=False): user_db = authenticate(username=user.username, password=old_password) if user_db is None: blank = blank_authenticate(user.username) if blank and not only_check: user.set_password(new_password or user.username) user.save() if user_db is None: user_db = authenticate(username=user.username, password=user.username) if not user_db: return -1 else: if not only_check:
return {"code": -1, "message": "User doesn't exist."} zebra_webhook_customer_subscription_created.connect(stripe_signup) def stripe_payment_history_sync(sender, full_json, **kwargs): stripe_id = full_json['data']['object']['customer'] try: profile = Profile.objects.get(stripe_id=stripe_id) profile.setup_premium_history() except Profile.DoesNotExist: return {"code": -1, "message": "User doesn't exist."} zebra_webhook_charge_succeeded.connect(stripe_payment_history_sync) def change_password(user, old_password, new_password, only_check=False): user_db = authenticate(username=user.username, password=old_password) if user_db is None: blank = blank_authenticate(user.username) if blank and not only_check: user.set_password(new_password or user.username) user.save() if user_db is None: user_db = authenticate(username=user.username, password=user.username) if not user_db: return -1 else: