mirror of https://github.com/zulip/zulip.git
urls: Remove unused URL names and shorten others.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
f078509105
commit
faf600e9f5
|
@ -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/<realm_str>/', analytics.views.get_realm_activity,
|
||||
name='analytics.views.get_realm_activity'),
|
||||
path('user_activity/<email>/', analytics.views.get_user_activity,
|
||||
name='analytics.views.get_user_activity'),
|
||||
name='support'),
|
||||
path('realm_activity/<realm_str>/', analytics.views.get_realm_activity),
|
||||
path('user_activity/<email>/', analytics.views.get_user_activity),
|
||||
|
||||
path('stats/realm/<realm_str>/', 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/<realm_str>/', analytics.views.stats_for_realm),
|
||||
path('stats/installation', analytics.views.stats_for_installation),
|
||||
path('stats/remote/<int:remote_server_id>/installation',
|
||||
analytics.views.stats_for_remote_installation,
|
||||
name='analytics.views.stats_for_remote_installation'),
|
||||
analytics.views.stats_for_remote_installation),
|
||||
path('stats/remote/<int:remote_server_id>/realm/<int:remote_realm_id>/',
|
||||
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,
|
||||
|
|
|
@ -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'<a href="{url}">{email}</a>'
|
||||
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'<a href="{url}">{realm_str}</a>'
|
||||
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'<a href="{url}"><i class="fa fa-pie-chart"></i>{realm_str}</a>'
|
||||
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'<a href="{url}"><i class="fa fa-pie-chart"></i>{hostname}</a>'
|
||||
return mark_safe(stats_link)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -18,7 +18,7 @@ the registration flow has its own (nearly identical) copy of the fields below in
|
|||
{% endif %}
|
||||
|
||||
<div class="form-horizontal white-box">
|
||||
<form method="post" class="form-horizontal" id="registration" action="{{ url('zerver.views.home.accounts_accept_terms') }}">
|
||||
<form method="post" class="form-horizontal" id="registration" action="{{ url('accept_terms') }}">
|
||||
{{ csrf_input }}
|
||||
<div class="control-group">
|
||||
<label for="id_email" class="control-label">{{ _("Email") }}</label>
|
||||
|
|
|
@ -22,7 +22,7 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
<h2>{{_('Owners') }}</h2>
|
||||
{% if direct_owners %}
|
||||
{% for direct_owner in direct_owners %}
|
||||
<p><input type="submit" formaction="{{ direct_owner.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
|
||||
<p><input type="submit" formaction="{{ direct_owner.realm.uri }}{{ url('login-local') }}"
|
||||
name="direct_email" class="btn-direct btn-admin" value="{{ direct_owner.delivery_email }}" /></p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
@ -31,7 +31,7 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
<h2>{{ _('Administrators') }}</h2>
|
||||
{% if direct_admins %}
|
||||
{% for direct_admin in direct_admins %}
|
||||
<p><input type="submit" formaction="{{ direct_admin.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
|
||||
<p><input type="submit" formaction="{{ direct_admin.realm.uri }}{{ url('login-local') }}"
|
||||
name="direct_email" class="btn-direct btn-admin" value="{{ direct_admin.delivery_email }}" /></p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
@ -40,7 +40,7 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
<h2>{{ _('Guest users') }}</h2>
|
||||
{% if guest_users %}
|
||||
{% for guest_user in guest_users %}
|
||||
<p><input type="submit" formaction="{{ guest_user.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
|
||||
<p><input type="submit" formaction="{{ guest_user.realm.uri }}{{ url('login-local') }}"
|
||||
name="direct_email" class="btn-direct btn-admin" value="{{ guest_user.delivery_email }}" /></p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
@ -52,7 +52,7 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
<h2>{{ _('Normal users') }}</h2>
|
||||
{% if direct_users %}
|
||||
{% for direct_user in direct_users %}
|
||||
<p><input type="submit" formaction="{{ direct_user.realm.uri }}{{ url('zerver.views.auth.dev_direct_login') }}"
|
||||
<p><input type="submit" formaction="{{ direct_user.realm.uri }}{{ url('login-local') }}"
|
||||
name="direct_email" class="btn-direct btn-admin" value="{{ direct_user.delivery_email }}" /></p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
@ -62,7 +62,7 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form name="change_realm" action="{{ url('zerver.views.auth.login_page') }}" method="post">
|
||||
<form name="change_realm" action="{{ url('login_page') }}" method="post">
|
||||
{{ csrf_input }}
|
||||
<h2>Realm</h2>
|
||||
<select name="new_realm" onchange="this.form.submit()">
|
||||
|
@ -74,10 +74,10 @@ page can be easily identified in it's respective JavaScript file -->
|
|||
</form>
|
||||
<div id="devtools-wrapper">
|
||||
<div id="devtools-registration">
|
||||
<form name="register_dev_user" action="{{ url('zerver.views.development.registration.register_development_user') }}" method="POST">
|
||||
<form name="register_dev_user" action="{{ url('register_dev_user') }}" method="POST">
|
||||
<input type="submit" class="btn btn-admin" value="Create New User" />
|
||||
</form>
|
||||
<form name="register_dev_realm" action="{{ url('zerver.views.development.registration.register_development_realm') }}" method="POST">
|
||||
<form name="register_dev_realm" action="{{ url('register_dev_realm') }}" method="POST">
|
||||
<input type="submit" class="btn btn-admin" value="Create New Realm" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -41,7 +41,7 @@ page can be easily identified in it's respective JavaScript file. -->
|
|||
{% else %}
|
||||
{% if password_auth_enabled %}
|
||||
<form name="login_form" id="login_form" method="post" class="login-form"
|
||||
action="{{ url('django.contrib.auth.views.login') }}">
|
||||
action="{{ url('login') }}">
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
|
||||
{% if two_factor_authentication_enabled %}
|
||||
|
|
|
@ -23,7 +23,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
|
|||
{% endtrans %}
|
||||
</div>
|
||||
|
||||
<form method="post" class="form-horizontal white-box" id="registration" action="{{ url('zerver.views.registration.accounts_register') }}">
|
||||
<form method="post" class="form-horizontal white-box" id="registration" action="{{ url('accounts_register') }}">
|
||||
{{ csrf_input }}
|
||||
|
||||
<fieldset class="org-registration">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<p>Forgot your password? No problem, we'll send a link to reset your password to the email you signed up with.</p>
|
||||
|
||||
<form method="post" class="form-horizontal" action="{{ url('zerver.views.auth.password_reset') }}">
|
||||
<form method="post" class="form-horizontal" action="{{ url('password_reset') }}">
|
||||
{{ csrf_input }}
|
||||
<div class="new-style">
|
||||
<div class="input-box horizontal moving-label">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
|
||||
<div class="white-box">
|
||||
<p>{% trans login_url=url('django.contrib.auth.views.login') %}Please <a href="{{ login_url }}">log in</a> with your new password.{% endtrans %}</p>
|
||||
<p>{% trans login_url=url('login') %}Please <a href="{{ login_url }}">log in</a> with your new password.{% endtrans %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -228,7 +228,7 @@ def generate_password_reset_url(user_profile: UserProfile,
|
|||
token_generator: PasswordResetTokenGenerator) -> str:
|
||||
token = token_generator.make_token(user_profile)
|
||||
uid = urlsafe_base64_encode(force_bytes(user_profile.id))
|
||||
endpoint = reverse('django.contrib.auth.views.password_reset_confirm',
|
||||
endpoint = reverse('password_reset_confirm',
|
||||
kwargs=dict(uidb64=uid, token=token))
|
||||
return f"{user_profile.realm.uri}{endpoint}"
|
||||
|
||||
|
|
|
@ -651,7 +651,7 @@ def generate_unauthed_file_access_url(path_id: str) -> str:
|
|||
token = base64.b16encode(signed_data.encode('utf-8')).decode('utf-8')
|
||||
|
||||
filename = path_id.split('/')[-1]
|
||||
return reverse('zerver.views.upload.serve_local_file_unauthed', args=[token, filename])
|
||||
return reverse('local_file_unauthed', args=[token, filename])
|
||||
|
||||
def get_local_file_path_id_from_token(token: str) -> Optional[str]:
|
||||
signer = TimestampSigner(salt=LOCAL_FILE_ACCESS_TOKEN_SALT)
|
||||
|
|
|
@ -93,7 +93,7 @@ from zerver.models import (
|
|||
get_user_by_delivery_email,
|
||||
)
|
||||
from zerver.signals import JUST_CREATED_THRESHOLD
|
||||
from zerver.views.auth import maybe_send_to_registration
|
||||
from zerver.views.auth import log_into_subdomain, maybe_send_to_registration
|
||||
from zproject.backends import (
|
||||
AUTH_BACKEND_NAME_MAP,
|
||||
AppleAuthBackend,
|
||||
|
@ -2940,7 +2940,7 @@ class GoogleAuthBackendTest(SocialAuthBase):
|
|||
token = ExternalAuthResult(data_dict=data).store_data()
|
||||
else:
|
||||
token = force_token
|
||||
url_path = reverse('zerver.views.auth.log_into_subdomain', args=[token])
|
||||
url_path = reverse(log_into_subdomain, args=[token])
|
||||
return self.client_get(url_path, subdomain=subdomain)
|
||||
|
||||
def test_redirect_to_next_url_for_log_into_subdomain(self) -> None:
|
||||
|
|
|
@ -1643,7 +1643,7 @@ so we didn't send them an invitation. We did send invitations to everyone else!"
|
|||
url = "/accounts/register/"
|
||||
response = self.client_post(url, {"key": registration_key, "from_confirmation": 1, "full_name": "alice"})
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response.url, reverse('django.contrib.auth.views.login') + '?email=' +
|
||||
self.assertEqual(response.url, reverse('login') + '?email=' +
|
||||
urllib.parse.quote_plus(email))
|
||||
|
||||
class InvitationsTestCase(InviteUserBase):
|
||||
|
|
|
@ -271,7 +271,7 @@ def login_or_register_remote_user(request: HttpRequest, result: ExternalAuthResu
|
|||
|
||||
redirect_to = result.data_dict.get('redirect_to', '')
|
||||
if is_realm_creation is not None and settings.FREE_TRIAL_DAYS not in [None, 0]:
|
||||
redirect_to = "{}?onboarding=true".format(reverse('corporate.views.initial_upgrade'))
|
||||
redirect_to = "{}?onboarding=true".format(reverse('initial_upgrade'))
|
||||
|
||||
redirect_to = get_safe_redirect_to(redirect_to, user_profile.realm.uri)
|
||||
return HttpResponseRedirect(redirect_to)
|
||||
|
@ -292,7 +292,7 @@ def finish_desktop_flow(request: HttpRequest, user_profile: UserProfile,
|
|||
iv = secrets.token_bytes(12)
|
||||
desktop_data = (iv + AESGCM(key).encrypt(iv, token.encode(), b"")).hex()
|
||||
context = {'desktop_data': desktop_data,
|
||||
'browser_url': reverse('zerver.views.auth.login_page',
|
||||
'browser_url': reverse('login_page',
|
||||
kwargs = {'template_name': 'zerver/login.html'}),
|
||||
'realm_icon_url': realm_icon_url(user_profile.realm)}
|
||||
return render(request, 'zerver/desktop_redirect.html', context=context)
|
||||
|
@ -497,7 +497,7 @@ def start_remote_user_sso(request: HttpRequest) -> HttpResponse:
|
|||
to do authentication, so we need this additional endpoint.
|
||||
"""
|
||||
query = request.META['QUERY_STRING']
|
||||
return redirect(add_query_to_redirect_url(reverse('login-sso'), query))
|
||||
return redirect(add_query_to_redirect_url(reverse(remote_user_sso), query))
|
||||
|
||||
@handle_desktop_flow
|
||||
def start_social_login(request: HttpRequest, backend: str, extra_arg: Optional[str]=None,
|
||||
|
@ -579,7 +579,7 @@ def redirect_and_log_into_subdomain(result: ExternalAuthResult) -> HttpResponse:
|
|||
token = result.store_data()
|
||||
realm = get_realm(result.data_dict["subdomain"])
|
||||
subdomain_login_uri = (realm.uri
|
||||
+ reverse('zerver.views.auth.log_into_subdomain', args=[token]))
|
||||
+ reverse(log_into_subdomain, args=[token]))
|
||||
return redirect(subdomain_login_uri)
|
||||
|
||||
def get_dev_users(realm: Optional[Realm]=None, extra_users_count: int=10) -> List[UserProfile]:
|
||||
|
@ -610,10 +610,10 @@ def show_deactivation_notice(request: HttpRequest) -> HttpResponse:
|
|||
return render(request, "zerver/deactivated.html",
|
||||
context={"deactivated_domain_name": realm.name})
|
||||
|
||||
return HttpResponseRedirect(reverse('zerver.views.auth.login_page'))
|
||||
return HttpResponseRedirect(reverse('login_page'))
|
||||
|
||||
def redirect_to_deactivation_notice() -> HttpResponse:
|
||||
return HttpResponseRedirect(reverse('zerver.views.auth.show_deactivation_notice'))
|
||||
return HttpResponseRedirect(reverse(show_deactivation_notice))
|
||||
|
||||
def add_dev_login_context(realm: Optional[Realm], context: Dict[str, Any]) -> None:
|
||||
users = get_dev_users(realm)
|
||||
|
@ -695,7 +695,7 @@ def login_page(
|
|||
elif request.user.is_authenticated and not is_preview:
|
||||
return HttpResponseRedirect(request.user.realm.uri)
|
||||
if is_subdomain_root_or_alias(request) and settings.ROOT_DOMAIN_LANDING_PAGE:
|
||||
redirect_url = reverse('zerver.views.registration.realm_redirect')
|
||||
redirect_url = reverse('realm_redirect')
|
||||
if request.GET:
|
||||
redirect_url = add_query_to_redirect_url(redirect_url, request.GET.urlencode())
|
||||
return HttpResponseRedirect(redirect_url)
|
||||
|
|
|
@ -232,4 +232,4 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
|||
|
||||
@zulip_login_required
|
||||
def desktop_home(request: HttpRequest) -> HttpResponse:
|
||||
return HttpResponseRedirect(reverse('zerver.views.home.home'))
|
||||
return HttpResponseRedirect(reverse(home))
|
||||
|
|
|
@ -162,7 +162,7 @@ def accounts_register(request: HttpRequest) -> HttpResponse:
|
|||
try:
|
||||
validate_email_not_already_in_realm(realm, email)
|
||||
except ValidationError:
|
||||
view_url = reverse('django.contrib.auth.views.login')
|
||||
view_url = reverse('login')
|
||||
redirect_url = add_query_to_redirect_url(view_url, 'email=' + urllib.parse.quote_plus(email))
|
||||
return HttpResponseRedirect(redirect_url)
|
||||
|
||||
|
@ -351,7 +351,7 @@ def accounts_register(request: HttpRequest) -> HttpResponse:
|
|||
# user-friendly error message, but it doesn't
|
||||
# particularly matter, because the registration form
|
||||
# is hidden for most users.
|
||||
view_url = reverse('django.contrib.auth.views.login')
|
||||
view_url = reverse('login')
|
||||
query = 'email=' + urllib.parse.quote_plus(email)
|
||||
redirect_url = add_query_to_redirect_url(view_url, query)
|
||||
return HttpResponseRedirect(redirect_url)
|
||||
|
@ -448,7 +448,7 @@ def login_and_go_to_home(request: HttpRequest, user_profile: UserProfile) -> Htt
|
|||
do_login(request, user_profile)
|
||||
# Using 'mark_sanitized' to work around false positive where Pysa thinks
|
||||
# that 'user_profile' is user-controlled
|
||||
return HttpResponseRedirect(mark_sanitized(user_profile.realm.uri) + reverse('zerver.views.home.home'))
|
||||
return HttpResponseRedirect(mark_sanitized(user_profile.realm.uri) + reverse('home'))
|
||||
|
||||
def prepare_activation_url(email: str, request: HttpRequest,
|
||||
realm_creation: bool=False,
|
||||
|
@ -484,7 +484,7 @@ def send_confirm_registration_email(email: str, activation_url: str, language: s
|
|||
realm=realm)
|
||||
|
||||
def redirect_to_email_login_url(email: str) -> HttpResponseRedirect:
|
||||
login_url = reverse('django.contrib.auth.views.login')
|
||||
login_url = reverse('login')
|
||||
email = urllib.parse.quote_plus(email)
|
||||
redirect_url = add_query_to_redirect_url(login_url, 'already_registered=' + email)
|
||||
return HttpResponseRedirect(redirect_url)
|
||||
|
@ -537,7 +537,7 @@ def accounts_home(request: HttpRequest, multiuse_object_key: str="",
|
|||
try:
|
||||
realm = get_realm(get_subdomain(request))
|
||||
except Realm.DoesNotExist:
|
||||
return HttpResponseRedirect(reverse('zerver.views.registration.find_account'))
|
||||
return HttpResponseRedirect(reverse(find_account))
|
||||
if realm.deactivated:
|
||||
return redirect_to_deactivation_notice()
|
||||
|
||||
|
@ -595,7 +595,7 @@ def generate_204(request: HttpRequest) -> HttpResponse:
|
|||
|
||||
def find_account(request: HttpRequest) -> HttpResponse:
|
||||
from zerver.context_processors import common_context
|
||||
url = reverse('zerver.views.registration.find_account')
|
||||
url = reverse('find_account')
|
||||
|
||||
emails: List[str] = []
|
||||
if request.method == 'POST':
|
||||
|
|
|
@ -1089,7 +1089,7 @@ class ZulipRemoteUserBackend(RemoteUserBackend, ExternalAuthMethod):
|
|||
def redirect_deactivated_user_to_login() -> HttpResponseRedirect:
|
||||
# Specifying the template name makes sure that the user is not redirected to dev_login in case of
|
||||
# a deactivated account on a test server.
|
||||
login_url = reverse('zerver.views.auth.login_page', kwargs = {'template_name': 'zerver/login.html'})
|
||||
login_url = reverse('login_page', kwargs = {'template_name': 'zerver/login.html'})
|
||||
redirect_url = login_url + '?is_deactivated=true'
|
||||
return HttpResponseRedirect(redirect_url)
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ def social_auth_finish(backend: Any,
|
|||
# unless the user manually edits the param. In any case, it's most appropriate to just take
|
||||
# them to find_account, as there isn't even an appropriate subdomain to take them to the login
|
||||
# form on.
|
||||
return HttpResponseRedirect(reverse('zerver.views.registration.find_account'))
|
||||
return HttpResponseRedirect(reverse('find_account'))
|
||||
|
||||
if inactive_user:
|
||||
backend.logger.info("Failed login attempt for deactivated account: %s@%s",
|
||||
|
@ -1736,7 +1736,7 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
|
|||
# If the above raise KeyError, it means invalid or no idp was specified,
|
||||
# we should log that and redirect to the login page.
|
||||
self.logger.info("/login/saml/ : Bad idp param: KeyError: %s.", str(e))
|
||||
return reverse('zerver.views.auth.login_page',
|
||||
return reverse('login_page',
|
||||
kwargs = {'template_name': 'zerver/login.html'})
|
||||
|
||||
# This where we change things. We need to pass some params
|
||||
|
@ -1982,8 +1982,8 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
|
|||
name=f'saml:{idp_name}',
|
||||
display_name=idp_dict.get('display_name', cls.auth_backend_name),
|
||||
display_icon=idp_dict.get('display_icon', cls.display_icon),
|
||||
login_url=reverse('login-social-extra-arg', args=('saml', idp_name)),
|
||||
signup_url=reverse('signup-social-extra-arg', args=('saml', idp_name)),
|
||||
login_url=reverse('login-social', args=('saml', idp_name)),
|
||||
signup_url=reverse('signup-social', args=('saml', idp_name)),
|
||||
)
|
||||
result.append(saml_dict)
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ urls = [
|
|||
|
||||
# The special no-password login endpoint for development
|
||||
path('devlogin/', zerver.views.auth.login_page,
|
||||
{'template_name': 'zerver/dev_login.html'}, name='zerver.views.auth.login_page'),
|
||||
{'template_name': 'zerver/dev_login.html'}, name='login_page'),
|
||||
|
||||
# Page for testing email templates
|
||||
path('emails/', zerver.views.development.email_log.email_page),
|
||||
|
@ -46,10 +46,10 @@ urls = [
|
|||
# Register New User and Realm
|
||||
path('devtools/register_user/',
|
||||
zerver.views.development.registration.register_development_user,
|
||||
name='zerver.views.development.registration.register_development_user'),
|
||||
name='register_dev_user'),
|
||||
path('devtools/register_realm/',
|
||||
zerver.views.development.registration.register_development_realm,
|
||||
name='zerver.views.development.registration.register_development_realm'),
|
||||
name='register_dev_realm'),
|
||||
|
||||
# Have easy access for error pages
|
||||
path('errors/404/', TemplateView.as_view(template_name='404.html')),
|
||||
|
|
120
zproject/urls.py
120
zproject/urls.py
|
@ -80,11 +80,9 @@ v1_api_and_json_patterns = [
|
|||
{'PATCH': 'zerver.views.realm.update_realm'}),
|
||||
|
||||
# Returns a 204, used by desktop app to verify connectivity status
|
||||
path('generate_204', zerver.views.registration.generate_204,
|
||||
name='zerver.views.registration.generate_204'),
|
||||
path('generate_204', zerver.views.registration.generate_204),
|
||||
|
||||
path('realm/subdomain/<subdomain>', zerver.views.realm.check_subdomain_available,
|
||||
name='zerver.views.realm.check_subdomain_available'),
|
||||
path('realm/subdomain/<subdomain>', zerver.views.realm.check_subdomain_available),
|
||||
|
||||
# realm/domains -> zerver.views.realm_domains
|
||||
path('realm/domains', rest_dispatch,
|
||||
|
@ -433,12 +431,11 @@ integrations_view = IntegrationView.as_view()
|
|||
# If you're adding a new page to the website (as opposed to a new
|
||||
# endpoint for use by code), you should add it here.
|
||||
i18n_urls = [
|
||||
path('', zerver.views.home.home, name='zerver.views.home.home'),
|
||||
path('', zerver.views.home.home, name='home'),
|
||||
# We have a desktop-specific landing page in case we change our /
|
||||
# to not log in in the future. We don't want to require a new
|
||||
# desktop app build for everyone in that case
|
||||
path('desktop_home/', zerver.views.home.desktop_home,
|
||||
name='zerver.views.home.desktop_home'),
|
||||
path('desktop_home/', zerver.views.home.desktop_home),
|
||||
|
||||
# Backwards-compatibility (legacy) Google auth URL for the mobile
|
||||
# apps; see https://github.com/zulip/zulip/issues/13081 for
|
||||
|
@ -448,57 +445,50 @@ i18n_urls = [
|
|||
|
||||
path('accounts/login/start/sso/', zerver.views.auth.start_remote_user_sso, name='start-login-sso'),
|
||||
path('accounts/login/sso/', zerver.views.auth.remote_user_sso, name='login-sso'),
|
||||
path('accounts/login/jwt/', zerver.views.auth.remote_user_jwt, name='login-jwt'),
|
||||
path('accounts/login/jwt/', zerver.views.auth.remote_user_jwt),
|
||||
path('accounts/login/social/<backend>', zerver.views.auth.start_social_login,
|
||||
name='login-social'),
|
||||
path('accounts/login/social/<backend>/<extra_arg>', zerver.views.auth.start_social_login,
|
||||
name='login-social-extra-arg'),
|
||||
name='login-social'),
|
||||
path('accounts/register/social/<backend>',
|
||||
zerver.views.auth.start_social_signup,
|
||||
name='signup-social'),
|
||||
path('accounts/register/social/<backend>/<extra_arg>',
|
||||
zerver.views.auth.start_social_signup,
|
||||
name='signup-social-extra-arg'),
|
||||
path('accounts/login/subdomain/<token>', zerver.views.auth.log_into_subdomain,
|
||||
name='zerver.views.auth.log_into_subdomain'),
|
||||
path('accounts/login/local/', zerver.views.auth.dev_direct_login,
|
||||
name='zerver.views.auth.dev_direct_login'),
|
||||
name='signup-social'),
|
||||
path('accounts/login/subdomain/<token>', zerver.views.auth.log_into_subdomain),
|
||||
path('accounts/login/local/', zerver.views.auth.dev_direct_login, name='login-local'),
|
||||
# We have two entries for accounts/login; only the first one is
|
||||
# used for URL resolution. The second here is to allow
|
||||
# reverse("django.contrib.auth.views.login") in templates to
|
||||
# reverse("login") in templates to
|
||||
# return `/accounts/login/`.
|
||||
path('accounts/login/', zerver.views.auth.login_page,
|
||||
{'template_name': 'zerver/login.html'}, name='zerver.views.auth.login_page'),
|
||||
{'template_name': 'zerver/login.html'}, name='login_page'),
|
||||
path('accounts/login/', LoginView.as_view(template_name='zerver/login.html'),
|
||||
name='django.contrib.auth.views.login'),
|
||||
path('accounts/logout/', zerver.views.auth.logout_then_login,
|
||||
name='zerver.views.auth.logout_then_login'),
|
||||
name='login'),
|
||||
path('accounts/logout/', zerver.views.auth.logout_then_login),
|
||||
|
||||
path('accounts/webathena_kerberos_login/',
|
||||
zerver.views.zephyr.webathena_kerberos_login,
|
||||
name='zerver.views.zephyr.webathena_kerberos_login'),
|
||||
zerver.views.zephyr.webathena_kerberos_login),
|
||||
|
||||
path('accounts/password/reset/', zerver.views.auth.password_reset,
|
||||
name='zerver.views.auth.password_reset'),
|
||||
path('accounts/password/reset/', zerver.views.auth.password_reset, name='password_reset'),
|
||||
path('accounts/password/reset/done/',
|
||||
PasswordResetDoneView.as_view(template_name='zerver/reset_emailed.html')),
|
||||
path('accounts/password/reset/<uidb64>/<token>/',
|
||||
PasswordResetConfirmView.as_view(success_url='/accounts/password/done/',
|
||||
template_name='zerver/reset_confirm.html',
|
||||
form_class=zerver.forms.LoggingSetPasswordForm),
|
||||
name='django.contrib.auth.views.password_reset_confirm'),
|
||||
name='password_reset_confirm'),
|
||||
path('accounts/password/done/',
|
||||
PasswordResetCompleteView.as_view(template_name='zerver/reset_done.html')),
|
||||
path('accounts/deactivated/',
|
||||
zerver.views.auth.show_deactivation_notice,
|
||||
name='zerver.views.auth.show_deactivation_notice'),
|
||||
zerver.views.auth.show_deactivation_notice),
|
||||
|
||||
# Displays digest email content in browser.
|
||||
path('digest/', zerver.views.digest.digest_page),
|
||||
|
||||
# Registration views, require a confirmation ID.
|
||||
path('accounts/home/', zerver.views.registration.accounts_home,
|
||||
name='zerver.views.registration.accounts_home'),
|
||||
path('accounts/home/', zerver.views.registration.accounts_home),
|
||||
path('accounts/send_confirm/<email>',
|
||||
TemplateView.as_view(
|
||||
template_name='zerver/accounts_send_confirm.html'),
|
||||
|
@ -507,60 +497,51 @@ i18n_urls = [
|
|||
TemplateView.as_view(
|
||||
template_name='zerver/accounts_send_confirm.html'),
|
||||
{'realm_creation': True}, name='new_realm_send_confirm'),
|
||||
path('accounts/register/', zerver.views.registration.accounts_register,
|
||||
name='zerver.views.registration.accounts_register'),
|
||||
path('accounts/register/', zerver.views.registration.accounts_register, name='accounts_register'),
|
||||
path('accounts/do_confirm/<confirmation_key>',
|
||||
zerver.views.registration.check_prereg_key_and_redirect,
|
||||
name='check_prereg_key_and_redirect'),
|
||||
|
||||
path('accounts/confirm_new_email/<confirmation_key>',
|
||||
zerver.views.user_settings.confirm_email_change,
|
||||
name='zerver.views.user_settings.confirm_email_change'),
|
||||
name='confirm_email_change'),
|
||||
|
||||
# Email unsubscription endpoint. Allows for unsubscribing from various types of emails,
|
||||
# including the welcome emails (day 1 & 2), missed PMs, etc.
|
||||
path('accounts/unsubscribe/<email_type>/<confirmation_key>',
|
||||
zerver.views.unsubscribe.email_unsubscribe,
|
||||
name='zerver.views.unsubscribe.email_unsubscribe'),
|
||||
zerver.views.unsubscribe.email_unsubscribe, name='unsubscribe'),
|
||||
|
||||
# Portico-styled page used to provide email confirmation of terms acceptance.
|
||||
path('accounts/accept_terms/', zerver.views.home.accounts_accept_terms,
|
||||
name='zerver.views.home.accounts_accept_terms'),
|
||||
path('accounts/accept_terms/', zerver.views.home.accounts_accept_terms, name='accept_terms'),
|
||||
|
||||
# Find your account
|
||||
path('accounts/find/', zerver.views.registration.find_account,
|
||||
name='zerver.views.registration.find_account'),
|
||||
path('accounts/find/', zerver.views.registration.find_account, name='find_account'),
|
||||
|
||||
# Go to organization subdomain
|
||||
path('accounts/go/', zerver.views.registration.realm_redirect,
|
||||
name='zerver.views.registration.realm_redirect'),
|
||||
path('accounts/go/', zerver.views.registration.realm_redirect, name='realm_redirect'),
|
||||
|
||||
# Realm Creation
|
||||
path('new/', zerver.views.registration.create_realm,
|
||||
name='zerver.views.create_realm'),
|
||||
path('new/', zerver.views.registration.create_realm),
|
||||
path('new/<creation_key>',
|
||||
zerver.views.registration.create_realm, name='zerver.views.create_realm'),
|
||||
zerver.views.registration.create_realm, name='create_realm'),
|
||||
|
||||
# Realm Reactivation
|
||||
path('reactivate/<confirmation_key>', zerver.views.realm.realm_reactivation,
|
||||
name='zerver.views.realm.realm_reactivation'),
|
||||
name='realm_reactivation'),
|
||||
|
||||
# Global public streams (Zulip's way of doing archives)
|
||||
path('archive/streams/<int:stream_id>/topics/<topic_name>',
|
||||
zerver.views.archive.archive,
|
||||
name='zerver.views.archive.archive'),
|
||||
zerver.views.archive.archive),
|
||||
path('archive/streams/<int:stream_id>/topics',
|
||||
zerver.views.archive.get_web_public_topics_backend,
|
||||
name='zerver.views.archive.get_web_public_topics_backend'),
|
||||
zerver.views.archive.get_web_public_topics_backend),
|
||||
|
||||
# Login/registration
|
||||
path('register/', zerver.views.registration.accounts_home, name='register'),
|
||||
path('login/', zerver.views.auth.login_page, {'template_name': 'zerver/login.html'},
|
||||
name='zerver.views.auth.login_page'),
|
||||
name='login_page'),
|
||||
|
||||
path('join/<confirmation_key>/',
|
||||
zerver.views.registration.accounts_home_from_multiuse_invite,
|
||||
name='zerver.views.registration.accounts_home_from_multiuse_invite'),
|
||||
zerver.views.registration.accounts_home_from_multiuse_invite, name='join'),
|
||||
|
||||
# Used to generate a Zoom video call URL
|
||||
path('calls/zoom/register', zerver.views.video_calls.register_zoom_user),
|
||||
|
@ -572,18 +553,17 @@ i18n_urls = [
|
|||
|
||||
# API and integrations documentation
|
||||
path('integrations/doc-html/<integration_name>',
|
||||
zerver.views.documentation.integration_doc,
|
||||
name="zerver.views.documentation.integration_doc"),
|
||||
zerver.views.documentation.integration_doc),
|
||||
path('integrations/', integrations_view),
|
||||
path('integrations/<path:path>', integrations_view),
|
||||
|
||||
# Landing page, features pages, signup form, etc.
|
||||
path('hello/', zerver.views.portico.hello_view, name='landing-page'),
|
||||
path('hello/', zerver.views.portico.hello_view),
|
||||
path('new-user/', RedirectView.as_view(url='/hello', permanent=True)),
|
||||
path('features/', zerver.views.portico.landing_view, {'template_name': 'zerver/features.html'}),
|
||||
path('plans/', zerver.views.portico.plans_view, name='plans'),
|
||||
path('apps/', zerver.views.portico.apps_view, name='zerver.views.home.apps_view'),
|
||||
path('apps/<platform>', zerver.views.portico.apps_view, name='zerver.views.home.apps_view'),
|
||||
path('apps/', zerver.views.portico.apps_view),
|
||||
path('apps/<platform>', zerver.views.portico.apps_view),
|
||||
path('team/', zerver.views.portico.team_view),
|
||||
path('history/', zerver.views.portico.landing_view, {'template_name': 'zerver/history.html'}),
|
||||
path('why-zulip/', zerver.views.portico.landing_view, {'template_name': 'zerver/why-zulip.html'}),
|
||||
|
@ -599,8 +579,8 @@ i18n_urls = [
|
|||
path('atlassian/', zerver.views.portico.landing_view, {'template_name': 'zerver/atlassian.html'}),
|
||||
|
||||
# Terms of Service and privacy pages.
|
||||
path('terms/', zerver.views.portico.terms_view, name='terms'),
|
||||
path('privacy/', zerver.views.portico.privacy_view, name='privacy'),
|
||||
path('terms/', zerver.views.portico.terms_view),
|
||||
path('privacy/', zerver.views.portico.privacy_view),
|
||||
path('config-error/<error_category_name>', zerver.views.auth.config_error_view,
|
||||
name='config_error'),
|
||||
path('config-error/remoteuser/<error_category_name>',
|
||||
|
@ -627,7 +607,7 @@ urls += [
|
|||
urls += [
|
||||
path('user_uploads/temporary/<token>/<filename>',
|
||||
zerver.views.upload.serve_local_file_unauthed,
|
||||
name='zerver.views.upload.serve_local_file_unauthed'),
|
||||
name='local_file_unauthed'),
|
||||
path('user_uploads/<realm_id_str>/<path:filename>',
|
||||
rest_dispatch,
|
||||
{'GET': ('zerver.views.upload.serve_file_backend',
|
||||
|
@ -653,8 +633,7 @@ urls += [
|
|||
# This url serves as a way to receive CSP violation reports from the users.
|
||||
# We use this endpoint to just log these reports.
|
||||
urls += [
|
||||
path('report/csp_violations', zerver.views.report.report_csp_violations,
|
||||
name='zerver.views.report.report_csp_violations'),
|
||||
path('report/csp_violations', zerver.views.report.report_csp_violations),
|
||||
]
|
||||
|
||||
# This url serves as a way to provide backward compatibility to messages
|
||||
|
@ -663,8 +642,7 @@ urls += [
|
|||
# images.
|
||||
urls += [
|
||||
path('external_content/<digest>/<received_url>',
|
||||
zerver.views.camo.handle_camo_url,
|
||||
name='zerver.views.camo.handle_camo_url'),
|
||||
zerver.views.camo.handle_camo_url),
|
||||
]
|
||||
|
||||
# Incoming webhook URLs
|
||||
|
@ -697,20 +675,16 @@ v1_api_mobile_patterns = [
|
|||
|
||||
# This json format view used by the mobile apps accepts a username
|
||||
# password/pair and returns an API key.
|
||||
path('fetch_api_key', zerver.views.auth.api_fetch_api_key,
|
||||
name='zerver.views.auth.api_fetch_api_key'),
|
||||
path('fetch_api_key', zerver.views.auth.api_fetch_api_key),
|
||||
|
||||
# This is for the signing in through the devAuthBackEnd on mobile apps.
|
||||
path('dev_fetch_api_key', zerver.views.auth.api_dev_fetch_api_key,
|
||||
name='zerver.views.auth.api_dev_fetch_api_key'),
|
||||
path('dev_fetch_api_key', zerver.views.auth.api_dev_fetch_api_key),
|
||||
# This is for fetching the emails of the admins and the users.
|
||||
path('dev_list_users', zerver.views.auth.api_dev_list_users,
|
||||
name='zerver.views.auth.api_dev_list_users'),
|
||||
path('dev_list_users', zerver.views.auth.api_dev_list_users),
|
||||
|
||||
# Used to present the GOOGLE_CLIENT_ID to mobile apps
|
||||
path('fetch_google_client_id',
|
||||
zerver.views.auth.api_fetch_google_client_id,
|
||||
name='zerver.views.auth.api_fetch_google_client_id'),
|
||||
zerver.views.auth.api_fetch_google_client_id),
|
||||
]
|
||||
urls += [
|
||||
path('api/v1/', include(v1_api_mobile_patterns)),
|
||||
|
@ -718,8 +692,7 @@ urls += [
|
|||
|
||||
# View for uploading messages from email mirror
|
||||
urls += [
|
||||
path('email_mirror_message', zerver.views.email_mirror.email_mirror_message,
|
||||
name='zerver.views.email_mirror.email_mirror_message'),
|
||||
path('email_mirror_message', zerver.views.email_mirror.email_mirror_message),
|
||||
]
|
||||
|
||||
# Include URL configuration files for site-specified extra installed
|
||||
|
@ -736,8 +709,7 @@ urls += [
|
|||
#
|
||||
# Since these views don't use rest_dispatch, they cannot have
|
||||
# asynchronous Tornado behavior.
|
||||
path('notify_tornado', zerver.tornado.views.notify,
|
||||
name='zerver.tornado.views.notify'),
|
||||
path('notify_tornado', zerver.tornado.views.notify),
|
||||
path('api/v1/events/internal', zerver.tornado.views.get_events_internal),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue