remote_billing: Fix up templates and HTML names in them.

These pages are generally used by both remoterealm and legacy server
flows, so should have general names.
This commit is contained in:
Mateusz Mandera 2023-12-10 17:57:27 +01:00 committed by Tim Abbott
parent 423aebf98e
commit 1e6d9d28f8
7 changed files with 31 additions and 34 deletions

View File

@ -105,7 +105,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
# Final confirmation page - just confirm your details, possibly
# agreeing to ToS if needed and an authenticated session will be granted:
self.assertEqual(result.status_code, 200)
self.assert_in_success_response(["Log in to Zulip server billing"], result)
self.assert_in_success_response(["Log in to Zulip plan management"], result)
self.assert_in_success_response([user.realm.host], result)
params = {}
@ -510,7 +510,7 @@ class LegacyServerLoginTest(BouncerTestCase):
result = self.client_get(confirmation_url, subdomain="selfhosting")
self.assertEqual(result.status_code, 200)
self.assert_in_success_response(
[f"Log in to Zulip server billing for {self.server.hostname}", email], result
[f"Log in to Zulip plan management for {self.server.hostname}", email], result
)
self.assert_in_success_response([f'action="{confirmation_url}"'], result)
if expect_tos:

View File

@ -203,7 +203,7 @@ def remote_realm_billing_finalize_login(
}
return render(
request,
"corporate/remote_realm_billing_finalize_login_confirmation.html",
"corporate/remote_billing_finalize_login_confirmation.html",
context=context,
)
else:
@ -218,9 +218,7 @@ def remote_realm_billing_finalize_login(
}
return render(
request,
# TODO: We're re-using a template originally made for the legacy server
# flow. We should rename it and its HTML contents to a more general name.
"corporate/remote_billing_legacy_server_confirm_login_form.html",
"corporate/remote_billing_confirm_email_form.html",
context=context,
)
@ -562,7 +560,7 @@ def remote_billing_legacy_server_login(
}
return render(
request,
"corporate/remote_billing_legacy_server_confirm_login_form.html",
"corporate/remote_billing_confirm_email_form.html",
context=context,
)
@ -677,9 +675,7 @@ def remote_billing_legacy_server_from_login_confirmation_link(
}
return render(
request,
# TODO: We're re-using the template, so it should be renamed
# to a more general name.
"corporate/remote_realm_billing_finalize_login_confirmation.html",
"corporate/remote_billing_finalize_login_confirmation.html",
context=context,
)

View File

@ -14,7 +14,7 @@
<p>Next, we will send a verification email to the address you provide.</p>
</div>
<div class="white-box">
<form id="server-confirm-login-form" method="post" action="{{ action_url }}">
<form id="remote-billing-confirm-email-form" method="post" action="{{ action_url }}">
{{ csrf_input }}
{% if next_page %}
<input type="hidden" name="next_page" value="{{ next_page }}" />
@ -24,7 +24,7 @@
<input id="email" name="email" class="email required" type="email" {% if email %}value="{{ email }}"{% endif %} />
</div>
<div class="upgrade-button-container">
<button type="submit" id="server-confirm-login-button" class="stripe-button-el invoice-button">
<button type="submit" id="remote-billing-confirm-email-button" class="stripe-button-el invoice-button">
<span class="server-login-button-text">Continue</span>
<img class="loader server-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
</button>

View File

@ -2,22 +2,21 @@
{% set entrypoint = "upgrade" %}
{% block title %}
<title>{{ _("Billing login confirmation") }} | Zulip</title>
<title>{{ _("Zulip plan management login confirmation") }} | Zulip</title>
{% endblock %}
{% block portico_content %}
<div id="remote-realm-confirm-login-page" class="register-account flex full-page">
<div id="remote-billing-confirm-login-page" class="register-account flex full-page">
<div class="center-block new-style">
<div class="pitch">
<h1>Log in to Zulip server billing for {{ host }}</h1>
<h1>Log in to Zulip plan management for {{ host }}</h1>
</div>
<div class="white-box">
<p>Click <b>Continue</b> to log in to Zulip server
billing with the account below.</p>
<p>Click <b>Continue</b> to log in to the Zulip plan management system with the account below.</p>
Email: {{ user_email }}<br />
<form id="remote-realm-confirm-login-form" method="post" action="{{ action_url }}">
<form id="remote-billing-confirm-login-form" method="post" action="{{ action_url }}">
{{ csrf_input }}
<div class="input-box remote-realm-confirm-login-form-field">
<div class="input-box remote-billing-confirm-login-form-field">
<label for="full_name" class="inline-block label-title">Full name</label>
<input id="full_name" name="full_name" class="required" type="text" {% if user_full_name %}value="{{ user_full_name }}"{% endif %} />
</div>
@ -31,9 +30,9 @@
</div>
{% endif %}
<div class="upgrade-button-container">
<button type="submit" id="remote-realm-confirm-login-button" class="stripe-button-el invoice-button">
<span class="remote-realm-confirm-login-button-text">Continue</span>
<img class="loader remote-realm-confirm-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
<button type="submit" id="remote-billing-confirm-login-button" class="stripe-button-el invoice-button">
<span class="remote-billing-confirm-login-button-text">Continue</span>
<img class="loader remote-billing-confirm-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
</button>
</div>
</form>

View File

@ -1,14 +1,14 @@
import $ from "jquery";
export function initialize(): void {
$("#server-login-form, #server-confirm-login-form").validate({
$("#server-login-form, #remote-billing-confirm-email-form").validate({
errorClass: "text-error",
wrapper: "div",
submitHandler(form) {
$("#server-login-form").find(".loader").css("display", "inline-block");
$("#server-login-button .server-login-button-text").hide();
$("#server-confirm-login-form").find(".loader").css("display", "inline-block");
$("#server-confirm-login-button .server-login-button-text").hide();
$("#remote-billing-confirm-email-form").find(".loader").css("display", "inline-block");
$("#remote-billing-confirm-email-button .server-login-button-text").hide();
form.submit();
},
@ -16,12 +16,12 @@ export function initialize(): void {
// this removes all previous errors that were put on screen
// by the server.
$("#server-login-form .alert.alert-error").remove();
$("#server-confirm-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-email-form .alert.alert-error").remove();
},
showErrors(error_map) {
if (error_map.password) {
$("#server-login-form .alert.alert-error").remove();
$("#server-confirm-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-email-form .alert.alert-error").remove();
}
this.defaultShowErrors!();
},

View File

@ -1,23 +1,25 @@
import $ from "jquery";
export function initialize(): void {
$("#remote-realm-confirm-login-form").find(".loader").hide();
$("#remote-billing-confirm-login-form").find(".loader").hide();
$("#remote-realm-confirm-login-form").validate({
$("#remote-billing-confirm-login-form").validate({
errorClass: "text-error",
wrapper: "div",
submitHandler(form) {
$("#remote-realm-confirm-login-form").find(".loader").show();
$("#remote-realm-confirm-login-button .remote-realm-confirm-login-button-text").hide();
$("#remote-billing-confirm-login-form").find(".loader").show();
$(
"#remote-billing-confirm-login-button .remote-billing-confirm-login-button-text",
).hide();
form.submit();
},
invalidHandler() {
$("#remote-realm-confirm-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-login-form .alert.alert-error").remove();
},
showErrors(error_map) {
if (error_map.id_terms) {
$("#remote-realm-confirm-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-login-form .alert.alert-error").remove();
}
this.defaultShowErrors!();
},

View File

@ -685,7 +685,7 @@ input[name="licenses"] {
display: none;
}
#remote-realm-confirm-login-form .text-error {
#remote-billing-confirm-login-form .text-error {
margin-bottom: 15px;
}