mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
confirmation: Rename REALM_CREATION to NEW_REALM_USER_REGISTRATION.
Clears up some naming confusion - `REALM_CREATION_LINK_VALIDITY_DAYS` is a setting which describes the validaty period of RealmCreationKey, not of Confirmation with REALM_CREATION type. Now that the latter is called NEW_REALM_USER_REGISTRATION, there should be no confusion about this.
This commit is contained in:
committed by
Tim Abbott
parent
8207eaab55
commit
072f234269
@@ -232,7 +232,7 @@ class Confirmation(models.Model):
|
||||
UNSUBSCRIBE = 4
|
||||
SERVER_REGISTRATION = 5
|
||||
MULTIUSE_INVITE = 6
|
||||
REALM_CREATION = 7
|
||||
NEW_REALM_USER_REGISTRATION = 7
|
||||
REALM_REACTIVATION = 8
|
||||
REMOTE_SERVER_BILLING_LEGACY_LOGIN = 9
|
||||
REMOTE_REALM_BILLING_LEGACY_LOGIN = 10
|
||||
@@ -272,7 +272,7 @@ _properties = {
|
||||
Confirmation.MULTIUSE_INVITE: ConfirmationType(
|
||||
"join", validity_in_days=settings.INVITATION_LINK_VALIDITY_DAYS
|
||||
),
|
||||
Confirmation.REALM_CREATION: ConfirmationType("get_prereg_key_and_redirect"),
|
||||
Confirmation.NEW_REALM_USER_REGISTRATION: ConfirmationType("get_prereg_key_and_redirect"),
|
||||
Confirmation.REALM_REACTIVATION: ConfirmationType("realm_reactivation_get"),
|
||||
}
|
||||
if settings.ZILENCER_ENABLED:
|
||||
@@ -298,7 +298,7 @@ def one_click_unsubscribe_link(user_profile: UserProfile, email_type: str) -> st
|
||||
# management command.
|
||||
# Note that being validated here will just allow the user to access the create_realm
|
||||
# form, where they will enter their email and go through the regular
|
||||
# Confirmation.REALM_CREATION pathway.
|
||||
# Confirmation.NEW_REALM_USER_REGISTRATION pathway.
|
||||
# Arguably RealmCreationKey should just be another ConfirmationObjT and we should
|
||||
# add another Confirmation.type for this; it's this way for historical reasons.
|
||||
|
||||
|
@@ -632,7 +632,7 @@ def support(
|
||||
user.id for user in PreregistrationRealm.objects.filter(email__in=key_words)
|
||||
]
|
||||
confirmations += get_confirmations(
|
||||
[Confirmation.REALM_CREATION],
|
||||
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||
preregistration_realm_ids,
|
||||
hostname=request.get_host(),
|
||||
)
|
||||
|
@@ -76,7 +76,7 @@
|
||||
{% set email = object.email %}
|
||||
{% set realm = object.realm %}
|
||||
{% set show_realm_details = True %}
|
||||
{% elif confirmation.type == Confirmation.REALM_CREATION %}
|
||||
{% elif confirmation.type == Confirmation.NEW_REALM_USER_REGISTRATION %}
|
||||
<h3>Realm creation</h3>
|
||||
{% set email = object.email %}
|
||||
{% set show_realm_details = False %}
|
||||
|
@@ -2273,7 +2273,9 @@ by Pieter
|
||||
|
||||
# Confirmation key at this point is marked, used but since we
|
||||
# are mocking the process, we need to do it manually here.
|
||||
get_object_from_key(confirmation_key, [Confirmation.REALM_CREATION], mark_object_used=True)
|
||||
get_object_from_key(
|
||||
confirmation_key, [Confirmation.NEW_REALM_USER_REGISTRATION], mark_object_used=True
|
||||
)
|
||||
result = self.client_get(f"/json/realm/import/status/{confirmation_key}")
|
||||
self.assert_in_success_response(["No users matching provided email"], result)
|
||||
|
||||
|
@@ -71,7 +71,7 @@ def register_development_realm(request: HttpRequest) -> HttpResponse:
|
||||
email, realm_name, realm_subdomain, realm_type, realm_default_language
|
||||
)
|
||||
activation_url = create_confirmation_link(
|
||||
prereg_realm, Confirmation.REALM_CREATION, no_associated_realm_object=True
|
||||
prereg_realm, Confirmation.NEW_REALM_USER_REGISTRATION, no_associated_realm_object=True
|
||||
)
|
||||
key = activation_url.split("/")[-1]
|
||||
# Need to add test data to POST request as it doesn't originally contain the required parameters
|
||||
@@ -106,7 +106,7 @@ def register_demo_development_realm(request: HttpRequest) -> HttpResponse:
|
||||
email, realm_name, realm_subdomain, realm_type, realm_default_language
|
||||
)
|
||||
activation_url = create_confirmation_link(
|
||||
prereg_realm, Confirmation.REALM_CREATION, no_associated_realm_object=True
|
||||
prereg_realm, Confirmation.NEW_REALM_USER_REGISTRATION, no_associated_realm_object=True
|
||||
)
|
||||
key = activation_url.split("/")[-1]
|
||||
# Need to add test data to POST request as it doesn't originally contain the required parameters
|
||||
|
@@ -194,7 +194,7 @@ def check_prereg_key(
|
||||
confirmation_types = [
|
||||
Confirmation.USER_REGISTRATION,
|
||||
Confirmation.INVITATION,
|
||||
Confirmation.REALM_CREATION,
|
||||
Confirmation.NEW_REALM_USER_REGISTRATION,
|
||||
]
|
||||
|
||||
prereg_object = get_object_from_key(
|
||||
@@ -203,7 +203,7 @@ def check_prereg_key(
|
||||
assert isinstance(prereg_object, PreregistrationRealm | PreregistrationUser)
|
||||
|
||||
confirmation_obj = prereg_object.confirmation.get()
|
||||
realm_creation = confirmation_obj.type == Confirmation.REALM_CREATION
|
||||
realm_creation = confirmation_obj.type == Confirmation.NEW_REALM_USER_REGISTRATION
|
||||
|
||||
if realm_creation:
|
||||
assert isinstance(prereg_object, PreregistrationRealm)
|
||||
@@ -998,7 +998,7 @@ def prepare_realm_activation_url(
|
||||
import_form,
|
||||
)
|
||||
activation_url = create_confirmation_link(
|
||||
prereg_realm, Confirmation.REALM_CREATION, no_associated_realm_object=True
|
||||
prereg_realm, Confirmation.NEW_REALM_USER_REGISTRATION, no_associated_realm_object=True
|
||||
)
|
||||
|
||||
if settings.DEVELOPMENT:
|
||||
@@ -1052,7 +1052,7 @@ def realm_import_status(
|
||||
try:
|
||||
preregistration_realm = get_object_from_key(
|
||||
confirmation_key,
|
||||
[Confirmation.REALM_CREATION],
|
||||
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||
mark_object_used=False,
|
||||
allow_used=True,
|
||||
)
|
||||
@@ -1147,7 +1147,7 @@ def realm_import_post_process(
|
||||
try:
|
||||
preregistration_realm = get_object_from_key(
|
||||
confirmation_key,
|
||||
[Confirmation.REALM_CREATION],
|
||||
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||
mark_object_used=False,
|
||||
allow_used=True,
|
||||
)
|
||||
|
@@ -320,7 +320,7 @@ def handle_tusd_hook(
|
||||
return reject_upload("Unauthenticated upload", 401)
|
||||
try:
|
||||
prereg_object = get_object_from_key(
|
||||
key, [Confirmation.REALM_CREATION], mark_object_used=False
|
||||
key, [Confirmation.NEW_REALM_USER_REGISTRATION], mark_object_used=False
|
||||
)
|
||||
except ConfirmationKeyError:
|
||||
return reject_upload("Unauthenticated upload", 401)
|
||||
|
Reference in New Issue
Block a user