137137 "SUBDOMAIN" : None ,
138138 "FLASH_MESSAGES" : True ,
139139 "RETURN_GENERIC_RESPONSES" : False ,
140- "USE_REGISTER_V2" : False ,
140+ "USE_REGISTER_V2" : True ,
141141 "I18N_DOMAIN" : "flask_security" ,
142142 "I18N_DIRNAME" : "builtin" ,
143143 "EMAIL_VALIDATOR_ARGS" : None ,
@@ -1239,6 +1239,10 @@ class Security:
12391239 .. versionadded:: 5.6.0
12401240 ``username_recovery_form``, ``change_username_form``,
12411241
1242+ .. versionchanged:: 5.7.0
1243+ ``register_form`` default value is RegisterFormV2 and
1244+ ``confirm_register_form`` default is now ``None``.
1245+
12421246 .. deprecated:: 4.0.0
12431247 ``send_mail`` and ``send_mail_task``. Replaced with ``mail_util_cls``.
12441248 ``two_factor_verify_password_form`` removed.
@@ -1263,8 +1267,8 @@ def __init__(
12631267 verify_form : t .Type [VerifyForm ] = VerifyForm ,
12641268 change_email_form : t .Type [ChangeEmailForm ] = ChangeEmailForm ,
12651269 change_username_form : t .Type [ChangeUsernameForm ] = ChangeUsernameForm ,
1266- confirm_register_form : t .Type [ConfirmRegisterForm ] = ConfirmRegisterForm ,
1267- register_form : t .Type [RegisterForm ] | t .Type [RegisterFormV2 ] = RegisterForm ,
1270+ confirm_register_form : t .Type [ConfirmRegisterForm ] | None = None ,
1271+ register_form : t .Type [RegisterForm ] | t .Type [RegisterFormV2 ] = RegisterFormV2 ,
12681272 forgot_password_form : t .Type [ForgotPasswordForm ] = ForgotPasswordForm ,
12691273 reset_password_form : t .Type [ResetPasswordForm ] = ResetPasswordForm ,
12701274 change_password_form : t .Type [ChangePasswordForm ] = ChangePasswordForm ,
@@ -1511,9 +1515,8 @@ def init_app(
15111515 ):
15121516 self .forms [form_name ].cls = form_cls
15131517
1514- self ._use_confirm_form = True
15151518 # deprecate confirm_register_form, ConfirmRegisterForm and RegisterForm
1516- if self .forms ["confirm_register_form" ].cls != ConfirmRegisterForm :
1519+ if self .forms ["confirm_register_form" ].cls :
15171520 warnings .warn (
15181521 "The ConfirmRegisterForm and the confirm_register_form"
15191522 " option are"
@@ -1522,10 +1525,8 @@ def init_app(
15221525 DeprecationWarning ,
15231526 stacklevel = 2 ,
15241527 )
1525- if (
1526- self .forms ["register_form" ].cls
1527- and self .forms ["register_form" ].cls != RegisterForm
1528- and issubclass (self .forms ["register_form" ].cls , RegisterForm )
1528+ if self .forms ["register_form" ].cls and issubclass (
1529+ self .forms ["register_form" ].cls , RegisterForm
15291530 ):
15301531 warnings .warn (
15311532 "The RegisterForm is"
@@ -1534,15 +1535,20 @@ def init_app(
15341535 DeprecationWarning ,
15351536 stacklevel = 2 ,
15361537 )
1537- if cv ("USE_REGISTER_V2" , app = app ):
1538+ if not cv ("USE_REGISTER_V2" , app = app ):
1539+ warnings .warn (
1540+ "The SECURITY_USE_REGISTER_V2 configuration option is"
1541+ " deprecated as of version 5.7.0 and will be removed in a future"
1542+ " release." ,
1543+ DeprecationWarning ,
1544+ stacklevel = 2 ,
1545+ )
1546+ # Switch back to old register and confirm_register forms
15381547 # Only do this is they haven't subclassed
1539- if self .forms ["register_form" ].cls == RegisterForm :
1540- self .forms ["register_form" ].cls = RegisterFormV2
1541- self .forms ["confirm_register_form" ].cls = None
1542- if self .forms ["register_form" ].cls and issubclass (
1543- self .forms ["register_form" ].cls , RegisterFormV2
1544- ):
1545- self ._use_confirm_form = False
1548+ if self .forms ["register_form" ].cls == RegisterFormV2 :
1549+ self .forms ["register_form" ].cls = RegisterForm
1550+ if not self .forms ["confirm_register_form" ].cls :
1551+ self .forms ["confirm_register_form" ].cls = ConfirmRegisterForm
15461552
15471553 # The following will be set as attributes and initialized from constructor or
15481554 # kwargs or config.
0 commit comments