List of all settings¶
Below are listed all possible Django REST Registration settings.
You should add them as keys (with values)
to your settings.REST_REGISTRATION
dict.
‘USER_VERIFICATION_ID_FIELD’¶
Default: 'pk'
Field used in verification, as part of signed data.
The given field should uniquely identify the user. This means that
using any user field which could change over time
(email
, username
) is NOT recommended.
‘REGISTER_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultRegisterUserSerializer'
The serializer used by register endpoint. It is used to validate the input data and save (create) the newly registered user. You can use your custom serializer to customise validation logic and the way the user is created in the database.
‘REGISTER_SERIALIZER_PASSWORD_CONFIRM’¶
Default: True
Used by DefaultRegisterUserSerializer
.
If True
, the serializer requires
additional field password_confirm
which value should be
the same as the value of password
field.
It may be useful to disable it if you perform password confirmation at the frontend level.
‘REGISTER_OUTPUT_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultUserProfileSerializer'
The default serializer used by register endpoint. It is used output the data associated with the newly registered user. You can use your custom serializer to customise the output representation of the user.
‘REGISTER_VERIFICATION_ENABLED’¶
Default: True
If enabled, then newly registered user will not
be verified (user field specified by
‘USER_VERIFICATION_FLAG_FIELD’ will be false),
and verification e-mail with activation link
will be sent to the user email (specified by USER_EMAIL_FIELD
).
‘REGISTER_VERIFICATION_PERIOD’¶
Default: datetime.timedelta(days=7)
Specifies how long the activation link will be valid.
‘REGISTER_VERIFICATION_URL’¶
Default: None
Frontend URL to which the query parameters will be appended to create the activation link for newly registered user.
‘REGISTER_VERIFICATION_EMAIL_TEMPLATES’¶
Default:
{'body': 'rest_registration/register/body.txt',
'subject': 'rest_registration/register/subject.txt'}
Directory of templates used to generate the verification email. There are separate templates for email body and subject. If you want to generate html emails please refer to HTML e-mail configuration.
‘REGISTER_VERIFICATION_AUTO_LOGIN’¶
Default: False
Specifies whether a user will be logged in automatically when they verify their registration.
‘LOGIN_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultLoginSerializer'
No description available, please add it here!
‘LOGIN_AUTHENTICATOR’¶
Default: 'rest_registration.utils.users.authenticate_by_login_data'
By default the login authenticator function will use ‘USER_LOGIN_FIELDS’ setting to extract the login field from the validated serializer data either by using the ‘login’ key or the specific login field name(s) (e.g. ‘username’, ‘email’).
You can change that behavior by overriding this setting.
The authenticator function receives these parameters as positional arguments:
data
- the validated data from the login serializer.
and these parameters as keyword arguments:
serializer
- the source login serializer which generated the input data. This parameter could be dropped in the future, so it should be retrieved viakwargs.get()
instead be named directly.
‘AUTH_TOKEN_MANAGER_CLASS’¶
Default: 'rest_registration.auth_token_managers.RestFrameworkAuthTokenManager'
The token manager class used by login
and logout which provides an interface for providing
and optionally revoking the token.
The class should inherit from
rest_registration.token_managers.AbstractTokenManager
.
‘SEND_RESET_PASSWORD_LINK_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultSendResetPasswordLinkSerializer'
The serializer used by send-reset-password-link
endpoint. You can use your custom serializer
to customise validation logic and perform additonal checks.
Please remember that it should implement get_user_or_none
method which is used to obtain the user matching the criteria.
‘SEND_RESET_PASSWORD_LINK_SERIALIZER_USE_EMAIL’¶
Default: False
Used specifically by DefaultSendResetPasswordLinkSerializer
.
If True
, use e-mail field instead of login fields to find
the user who should receive the reset password link.
‘RESET_PASSWORD_FAIL_WHEN_USER_NOT_FOUND’¶
Default: True
If True
, then reveal that the user does not exist
while reset password link is being sent by signaling an error.
‘RESET_PASSWORD_VERIFICATION_PERIOD’¶
Default: datetime.timedelta(days=1)
No description available, please add it here!
‘RESET_PASSWORD_VERIFICATION_ONE_TIME_USE’¶
Default: False
No description available, please add it here!
‘RESET_PASSWORD_VERIFICATION_EMAIL_TEMPLATES’¶
Default:
{'body': 'rest_registration/reset_password/body.txt',
'subject': 'rest_registration/reset_password/subject.txt'}
No description available, please add it here!
‘RESET_PASSWORD_SERIALIZER_PASSWORD_CONFIRM’¶
Default: False
Used by ResetPasswordSerializer
.
If True
, the serializer requires
additional field password_confirm
which value should be
the same as the value of password
field.
It may be useful to disable it (this is currently the default) if you perform password confirmation at the frontend level.
‘REGISTER_EMAIL_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultRegisterEmailSerializer'
The serializer used by register-email endpoint.
It is used to validate the input data and obtain new e-mail.
You can use your custom serializer
to customise validation logic. Please remember that it should
implement get_email
method.
‘REGISTER_EMAIL_VERIFICATION_PERIOD’¶
Default: datetime.timedelta(days=7)
No description available, please add it here!
‘REGISTER_EMAIL_VERIFICATION_EMAIL_TEMPLATES’¶
Default:
{'body': 'rest_registration/register_email/body.txt',
'subject': 'rest_registration/register_email/subject.txt'}
No description available, please add it here!
‘VERIFICATION_EMAIL_HTML_TO_TEXT_CONVERTER’¶
Default: 'rest_registration.utils.html.convert_html_to_text_preserving_urls'
No description available, please add it here!
‘VERIFICATION_URL_BUILDER’¶
Default: 'rest_registration.utils.verification.build_default_verification_url'
The builder function receives the signer
object and construct
the url using signer.get_base_url()
and signer.get_signed_data()
. The default url builder will use
the base url and append the signed data as HTTP GET query string.
It is be solely up to the implementer of custom builder function
to encode the signed values properly in the URL.
‘VERIFICATION_TEMPLATE_CONTEXT_BUILDER’¶
Default: 'rest_registration.utils.verification.build_default_template_context'
The builder function receives these parameters as positional arguments:
user
- the user which is to be notified.user_address
- the user address, which can be the user e-mail, phone number, etc.data
- dictionary; in most cases it contains only one entry, which is theparam_signer
under'param_signer'
key. The implementer of the custom builder function should be aware that the contents of the dictionary are dynamic and write defensive code to account that.
and these parameters as keyword arguments:
notification_type
- value ofrest_registration.notifications.enums.NotificationType
enum.notification_method
- value ofrest_registration.notifications.enums.NotificationMethod
enum. Currently there is only one choice which isNotificationMethod.EMAIL
.
It is possible that in the future, additional keyword arguments
may be added. Therefore the implementer
of the custom builder function should take account of that,
for instance by adding **kwargs
in the signature
of the function.
‘CHANGE_PASSWORD_SERIALIZER_PASSWORD_CONFIRM’¶
Default: True
No description available, please add it here!
‘PROFILE_SERIALIZER_CLASS’¶
Default: 'rest_registration.api.serializers.DefaultUserProfileSerializer'
No description available, please add it here!
‘SUCCESS_RESPONSE_BUILDER’¶
Default: 'rest_registration.utils.responses.build_default_success_response'
No description available, please add it here!
‘USE_NON_FIELD_ERRORS_KEY_FROM_DRF_SETTINGS’¶
Default: False
If True
, the base API exception class will wrap the detail
string message (or message list) into a dictionary with a key
defined by REST_FRAMEWORK['NON_FIELD_ERRORS_KEY']
.
‘NOT_AUTHENTICATED_PERMISSION_CLASSES’¶
Default: ['rest_framework.permissions.AllowAny']
This parameter establishes the permissions of the views that must
be accessible without logging in.
Basically replace AllowAny
with the specified class.