billing: Better error message for dev on lacking Stripe credentials.

Normal server admins will never run this code, and zulipchat.com will
have this information configured before users see it, so this message
is really just for development.
This commit is contained in:
Greg Price 2018-01-17 16:05:18 -08:00
parent 455b77225f
commit 3aa5529b96
1 changed files with 4 additions and 0 deletions

View File

@ -123,6 +123,10 @@ def add_payment_method(request: HttpRequest) -> HttpResponse:
ctx["error_message"] = _("You should be an administrator of the organization %s to view this page." ctx["error_message"] = _("You should be an administrator of the organization %s to view this page."
% (user.realm.name,)) % (user.realm.name,))
return render(request, 'zilencer/payment.html', context=ctx) return render(request, 'zilencer/payment.html', context=ctx)
if STRIPE_PUBLISHABLE_KEY is None:
# Dev-only message; no translation needed.
ctx["error_message"] = "Missing Stripe config. In dev, add to zproject/dev-secrets.conf ."
return render(request, 'zilencer/payment.html', context=ctx)
try: try:
if request.method == "GET": if request.method == "GET":