mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +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
|
UNSUBSCRIBE = 4
|
||||||
SERVER_REGISTRATION = 5
|
SERVER_REGISTRATION = 5
|
||||||
MULTIUSE_INVITE = 6
|
MULTIUSE_INVITE = 6
|
||||||
REALM_CREATION = 7
|
NEW_REALM_USER_REGISTRATION = 7
|
||||||
REALM_REACTIVATION = 8
|
REALM_REACTIVATION = 8
|
||||||
REMOTE_SERVER_BILLING_LEGACY_LOGIN = 9
|
REMOTE_SERVER_BILLING_LEGACY_LOGIN = 9
|
||||||
REMOTE_REALM_BILLING_LEGACY_LOGIN = 10
|
REMOTE_REALM_BILLING_LEGACY_LOGIN = 10
|
||||||
@@ -272,7 +272,7 @@ _properties = {
|
|||||||
Confirmation.MULTIUSE_INVITE: ConfirmationType(
|
Confirmation.MULTIUSE_INVITE: ConfirmationType(
|
||||||
"join", validity_in_days=settings.INVITATION_LINK_VALIDITY_DAYS
|
"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"),
|
Confirmation.REALM_REACTIVATION: ConfirmationType("realm_reactivation_get"),
|
||||||
}
|
}
|
||||||
if settings.ZILENCER_ENABLED:
|
if settings.ZILENCER_ENABLED:
|
||||||
@@ -298,7 +298,7 @@ def one_click_unsubscribe_link(user_profile: UserProfile, email_type: str) -> st
|
|||||||
# management command.
|
# management command.
|
||||||
# Note that being validated here will just allow the user to access the create_realm
|
# 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
|
# 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
|
# Arguably RealmCreationKey should just be another ConfirmationObjT and we should
|
||||||
# add another Confirmation.type for this; it's this way for historical reasons.
|
# 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)
|
user.id for user in PreregistrationRealm.objects.filter(email__in=key_words)
|
||||||
]
|
]
|
||||||
confirmations += get_confirmations(
|
confirmations += get_confirmations(
|
||||||
[Confirmation.REALM_CREATION],
|
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||||
preregistration_realm_ids,
|
preregistration_realm_ids,
|
||||||
hostname=request.get_host(),
|
hostname=request.get_host(),
|
||||||
)
|
)
|
||||||
|
@@ -76,7 +76,7 @@
|
|||||||
{% set email = object.email %}
|
{% set email = object.email %}
|
||||||
{% set realm = object.realm %}
|
{% set realm = object.realm %}
|
||||||
{% set show_realm_details = True %}
|
{% set show_realm_details = True %}
|
||||||
{% elif confirmation.type == Confirmation.REALM_CREATION %}
|
{% elif confirmation.type == Confirmation.NEW_REALM_USER_REGISTRATION %}
|
||||||
<h3>Realm creation</h3>
|
<h3>Realm creation</h3>
|
||||||
{% set email = object.email %}
|
{% set email = object.email %}
|
||||||
{% set show_realm_details = False %}
|
{% set show_realm_details = False %}
|
||||||
|
@@ -2273,7 +2273,9 @@ by Pieter
|
|||||||
|
|
||||||
# Confirmation key at this point is marked, used but since we
|
# Confirmation key at this point is marked, used but since we
|
||||||
# are mocking the process, we need to do it manually here.
|
# 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}")
|
result = self.client_get(f"/json/realm/import/status/{confirmation_key}")
|
||||||
self.assert_in_success_response(["No users matching provided email"], result)
|
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
|
email, realm_name, realm_subdomain, realm_type, realm_default_language
|
||||||
)
|
)
|
||||||
activation_url = create_confirmation_link(
|
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]
|
key = activation_url.split("/")[-1]
|
||||||
# Need to add test data to POST request as it doesn't originally contain the required parameters
|
# 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
|
email, realm_name, realm_subdomain, realm_type, realm_default_language
|
||||||
)
|
)
|
||||||
activation_url = create_confirmation_link(
|
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]
|
key = activation_url.split("/")[-1]
|
||||||
# Need to add test data to POST request as it doesn't originally contain the required parameters
|
# 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_types = [
|
||||||
Confirmation.USER_REGISTRATION,
|
Confirmation.USER_REGISTRATION,
|
||||||
Confirmation.INVITATION,
|
Confirmation.INVITATION,
|
||||||
Confirmation.REALM_CREATION,
|
Confirmation.NEW_REALM_USER_REGISTRATION,
|
||||||
]
|
]
|
||||||
|
|
||||||
prereg_object = get_object_from_key(
|
prereg_object = get_object_from_key(
|
||||||
@@ -203,7 +203,7 @@ def check_prereg_key(
|
|||||||
assert isinstance(prereg_object, PreregistrationRealm | PreregistrationUser)
|
assert isinstance(prereg_object, PreregistrationRealm | PreregistrationUser)
|
||||||
|
|
||||||
confirmation_obj = prereg_object.confirmation.get()
|
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:
|
if realm_creation:
|
||||||
assert isinstance(prereg_object, PreregistrationRealm)
|
assert isinstance(prereg_object, PreregistrationRealm)
|
||||||
@@ -998,7 +998,7 @@ def prepare_realm_activation_url(
|
|||||||
import_form,
|
import_form,
|
||||||
)
|
)
|
||||||
activation_url = create_confirmation_link(
|
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:
|
if settings.DEVELOPMENT:
|
||||||
@@ -1052,7 +1052,7 @@ def realm_import_status(
|
|||||||
try:
|
try:
|
||||||
preregistration_realm = get_object_from_key(
|
preregistration_realm = get_object_from_key(
|
||||||
confirmation_key,
|
confirmation_key,
|
||||||
[Confirmation.REALM_CREATION],
|
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||||
mark_object_used=False,
|
mark_object_used=False,
|
||||||
allow_used=True,
|
allow_used=True,
|
||||||
)
|
)
|
||||||
@@ -1147,7 +1147,7 @@ def realm_import_post_process(
|
|||||||
try:
|
try:
|
||||||
preregistration_realm = get_object_from_key(
|
preregistration_realm = get_object_from_key(
|
||||||
confirmation_key,
|
confirmation_key,
|
||||||
[Confirmation.REALM_CREATION],
|
[Confirmation.NEW_REALM_USER_REGISTRATION],
|
||||||
mark_object_used=False,
|
mark_object_used=False,
|
||||||
allow_used=True,
|
allow_used=True,
|
||||||
)
|
)
|
||||||
|
@@ -320,7 +320,7 @@ def handle_tusd_hook(
|
|||||||
return reject_upload("Unauthenticated upload", 401)
|
return reject_upload("Unauthenticated upload", 401)
|
||||||
try:
|
try:
|
||||||
prereg_object = get_object_from_key(
|
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:
|
except ConfirmationKeyError:
|
||||||
return reject_upload("Unauthenticated upload", 401)
|
return reject_upload("Unauthenticated upload", 401)
|
||||||
|
Reference in New Issue
Block a user