diff --git a/analytics/urls.py b/analytics/urls.py index 225948e301..62fc35c5a5 100644 --- a/analytics/urls.py +++ b/analytics/urls.py @@ -6,25 +6,18 @@ from zerver.lib.rest import rest_dispatch i18n_urlpatterns = [ # Server admin (user_profile.is_staff) visible stats pages - path('activity', analytics.views.get_activity, - name='analytics.views.get_activity'), + path('activity', analytics.views.get_activity), path('activity/support', analytics.views.support, - name='analytics.views.support'), - path('realm_activity//', analytics.views.get_realm_activity, - name='analytics.views.get_realm_activity'), - path('user_activity//', analytics.views.get_user_activity, - name='analytics.views.get_user_activity'), + name='support'), + path('realm_activity//', analytics.views.get_realm_activity), + path('user_activity//', analytics.views.get_user_activity), - path('stats/realm//', analytics.views.stats_for_realm, - name='analytics.views.stats_for_realm'), - path('stats/installation', analytics.views.stats_for_installation, - name='analytics.views.stats_for_installation'), + path('stats/realm//', analytics.views.stats_for_realm), + path('stats/installation', analytics.views.stats_for_installation), path('stats/remote//installation', - analytics.views.stats_for_remote_installation, - name='analytics.views.stats_for_remote_installation'), + analytics.views.stats_for_remote_installation), path('stats/remote//realm//', - analytics.views.stats_for_remote_realm, - name='analytics.views.stats_for_remote_realm'), + analytics.views.stats_for_remote_realm), # User-visible stats page path('stats', analytics.views.stats, diff --git a/analytics/views.py b/analytics/views.py index d36ceaec30..c3aa1e498b 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -1352,26 +1352,22 @@ def format_date_for_activity_reports(date: Optional[datetime]) -> str: return '' def user_activity_link(email: str) -> mark_safe: - url_name = 'analytics.views.get_user_activity' - url = reverse(url_name, kwargs=dict(email=email)) + url = reverse(get_user_activity, kwargs=dict(email=email)) email_link = f'{email}' return mark_safe(email_link) def realm_activity_link(realm_str: str) -> mark_safe: - url_name = 'analytics.views.get_realm_activity' - url = reverse(url_name, kwargs=dict(realm_str=realm_str)) + url = reverse(get_realm_activity, kwargs=dict(realm_str=realm_str)) realm_link = f'{realm_str}' return mark_safe(realm_link) def realm_stats_link(realm_str: str) -> mark_safe: - url_name = 'analytics.views.stats_for_realm' - url = reverse(url_name, kwargs=dict(realm_str=realm_str)) + url = reverse(stats_for_realm, kwargs=dict(realm_str=realm_str)) stats_link = f'{realm_str}' return mark_safe(stats_link) def remote_installation_stats_link(server_id: int, hostname: str) -> mark_safe: - url_name = 'analytics.views.stats_for_remote_installation' - url = reverse(url_name, kwargs=dict(remote_server_id=server_id)) + url = reverse(stats_for_remote_installation, kwargs=dict(remote_server_id=server_id)) stats_link = f'{hostname}' return mark_safe(stats_link) diff --git a/confirmation/models.py b/confirmation/models.py index 55faff3471..e0ce38434f 100644 --- a/confirmation/models.py +++ b/confirmation/models.py @@ -122,16 +122,16 @@ _properties = { Confirmation.USER_REGISTRATION: ConfirmationType('check_prereg_key_and_redirect'), Confirmation.INVITATION: ConfirmationType('check_prereg_key_and_redirect', validity_in_days=settings.INVITATION_LINK_VALIDITY_DAYS), - Confirmation.EMAIL_CHANGE: ConfirmationType('zerver.views.user_settings.confirm_email_change'), + Confirmation.EMAIL_CHANGE: ConfirmationType('confirm_email_change'), Confirmation.UNSUBSCRIBE: ConfirmationType( - 'zerver.views.unsubscribe.email_unsubscribe', + 'unsubscribe', validity_in_days=1000000, # should never expire ), Confirmation.MULTIUSE_INVITE: ConfirmationType( - 'zerver.views.registration.accounts_home_from_multiuse_invite', + 'join', validity_in_days=settings.INVITATION_LINK_VALIDITY_DAYS), Confirmation.REALM_CREATION: ConfirmationType('check_prereg_key_and_redirect'), - Confirmation.REALM_REACTIVATION: ConfirmationType('zerver.views.realm.realm_reactivation'), + Confirmation.REALM_REACTIVATION: ConfirmationType('realm_reactivation'), } def one_click_unsubscribe_link(user_profile: UserProfile, email_type: str) -> str: @@ -171,7 +171,7 @@ def generate_realm_creation_url(by_admin: bool=False) -> str: presume_email_valid=by_admin) return urljoin( settings.ROOT_DOMAIN_URI, - reverse('zerver.views.create_realm', kwargs={'creation_key': key}), + reverse('create_realm', kwargs={'creation_key': key}), ) class RealmCreationKey(models.Model): diff --git a/corporate/urls.py b/corporate/urls.py index d2c81b0eee..9019dc8eae 100644 --- a/corporate/urls.py +++ b/corporate/urls.py @@ -15,8 +15,8 @@ i18n_urlpatterns: Any = [ path('jobs/', TemplateView.as_view(template_name='corporate/jobs.html')), # Billing - path('billing/', corporate.views.billing_home, name='corporate.views.billing_home'), - path('upgrade/', corporate.views.initial_upgrade, name='corporate.views.initial_upgrade'), + path('billing/', corporate.views.billing_home), + path('upgrade/', corporate.views.initial_upgrade, name='initial_upgrade'), ] v1_api_and_json_patterns = [ diff --git a/corporate/views.py b/corporate/views.py index 974d72d44d..e2ae4c82b0 100644 --- a/corporate/views.py +++ b/corporate/views.py @@ -154,7 +154,7 @@ def initial_upgrade(request: HttpRequest) -> HttpResponse: if not settings.BILLING_ENABLED or user.is_guest: return render(request, "404.html", status=404) - billing_page_url = reverse('corporate.views.billing_home') + billing_page_url = reverse(billing_home) customer = get_customer_by_realm(user.realm) if customer is not None and (get_current_plan_by_customer(customer) is not None or customer.sponsorship_pending): @@ -205,7 +205,7 @@ def sponsorship(request: HttpRequest, user: UserProfile, user_role = user.get_role_name() support_realm_uri = get_realm(settings.STAFF_SUBDOMAIN).uri - support_url = urljoin(support_realm_uri, urlunsplit(("", "", reverse('analytics.views.support'), + support_url = urljoin(support_realm_uri, urlunsplit(("", "", reverse("support"), urlencode({"q": realm.string_id}), ""))) context = { @@ -246,14 +246,14 @@ def billing_home(request: HttpRequest) -> HttpResponse: return render(request, 'corporate/billing.html', context=context) if customer is None: - return HttpResponseRedirect(reverse('corporate.views.initial_upgrade')) + return HttpResponseRedirect(reverse(initial_upgrade)) if customer.sponsorship_pending: context["sponsorship_pending"] = True return render(request, 'corporate/billing.html', context=context) if not CustomerPlan.objects.filter(customer=customer).exists(): - return HttpResponseRedirect(reverse('corporate.views.initial_upgrade')) + return HttpResponseRedirect(reverse(initial_upgrade)) if not user.has_billing_access: return render(request, 'corporate/billing.html', context=context) diff --git a/templates/zerver/accounts_accept_terms.html b/templates/zerver/accounts_accept_terms.html index 338c9cb6ef..c24ff30679 100644 --- a/templates/zerver/accounts_accept_terms.html +++ b/templates/zerver/accounts_accept_terms.html @@ -18,7 +18,7 @@ the registration flow has its own (nearly identical) copy of the fields below in {% endif %}
-
+ {{ csrf_input }}
diff --git a/templates/zerver/dev_login.html b/templates/zerver/dev_login.html index 7d0c931555..02fc515d61 100644 --- a/templates/zerver/dev_login.html +++ b/templates/zerver/dev_login.html @@ -22,7 +22,7 @@ page can be easily identified in it's respective JavaScript file -->

{{_('Owners') }}

{% if direct_owners %} {% for direct_owner in direct_owners %} -

{% endfor %} {% else %} @@ -31,7 +31,7 @@ page can be easily identified in it's respective JavaScript file -->

{{ _('Administrators') }}

{% if direct_admins %} {% for direct_admin in direct_admins %} -

{% endfor %} {% else %} @@ -40,7 +40,7 @@ page can be easily identified in it's respective JavaScript file -->

{{ _('Guest users') }}

{% if guest_users %} {% for guest_user in guest_users %} -

{% endfor %} {% else %} @@ -52,7 +52,7 @@ page can be easily identified in it's respective JavaScript file -->

{{ _('Normal users') }}

{% if direct_users %} {% for direct_user in direct_users %} -

{% endfor %} {% else %} @@ -62,7 +62,7 @@ page can be easily identified in it's respective JavaScript file -->
-
+ {{ csrf_input }}

Realm

-
+
diff --git a/templates/zerver/login.html b/templates/zerver/login.html index da0ca708df..c85e3c8892 100644 --- a/templates/zerver/login.html +++ b/templates/zerver/login.html @@ -41,7 +41,7 @@ page can be easily identified in it's respective JavaScript file. --> {% else %} {% if password_auth_enabled %}