From fa182f8205b5e72369bbb70092b2e52c92a27493 Mon Sep 17 00:00:00 2001 From: fmigneault Date: Wed, 16 Jun 2021 19:15:56 -0400 Subject: [PATCH] add references to email self-update disabled when self-registration enabled (#436) --- CHANGES.rst | 3 ++- magpie/api/management/user/user_utils.py | 1 + magpie/ui/user/templates/edit_current_user.mako | 1 + magpie/ui/user/views.py | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b5c433109..232715be1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,7 +20,8 @@ Features / Changes * Add UI view to display pending user registration details. * Add UI icon to indicate when a listed user is pending registration approval or email validation. * Disable user email self-update (when not administrator) both on the API and UI side - whenever ``MAGPIE_USER_REGISTRATION_ENABLED`` was activated to avoid losing the confirmation of the original email. + whenever ``MAGPIE_USER_REGISTRATION_ENABLED`` was activated to avoid losing the confirmation of the original email + (see feature `#436 `_). * Add configuration setting ``MAGPIE_USER_REGISTRATION_ENABLED`` to control whether user account self-registration feature should be employed. With it comes multiple other ``MAGPIE_USER_REGISTRATION_<...>`` settings to customize notification emails. diff --git a/magpie/api/management/user/user_utils.py b/magpie/api/management/user/user_utils.py index 36bc25ca9..cde3c5d33 100644 --- a/magpie/api/management/user/user_utils.py +++ b/magpie/api/management/user/user_utils.py @@ -192,6 +192,7 @@ def update_user(user, request, new_user_name=None, new_password=None, new_email= http_error=HTTPBadRequest, msg_on_fail=s.User_PATCH_BadRequestResponseSchema.description) # FIXME: disable email edit when self-registration is enabled to avoid not having any confirmation of new email + # (see https://github.com/Ouranosinc/Magpie/issues/436) update_email_admin_only = False if update_email and asbool(get_constant("MAGPIE_USER_REGISTRATION_ENABLED", request)): update_email_admin_only = True diff --git a/magpie/ui/user/templates/edit_current_user.mako b/magpie/ui/user/templates/edit_current_user.mako index a47b5ca92..6b82bbb96 100644 --- a/magpie/ui/user/templates/edit_current_user.mako +++ b/magpie/ui/user/templates/edit_current_user.mako @@ -187,6 +187,7 @@ %elif not user_edit_email:
+ LOCKED diff --git a/magpie/ui/user/views.py b/magpie/ui/user/views.py index d69d1499e..0c7249f56 100644 --- a/magpie/ui/user/views.py +++ b/magpie/ui/user/views.py @@ -77,6 +77,7 @@ def edit_current_user(self): user_info["joined_groups"] = joined_groups user_info["groups"] = public_groups # FIXME: disable email edit when self-registration is enabled to avoid not having any confirmation of new email + # (see https://github.com/Ouranosinc/Magpie/issues/436) user_info["user_edit_email"] = not asbool(get_constant("MAGPIE_USER_REGISTRATION_ENABLED", self.request)) user_info["user_with_error"] = schemas.UserStatuses.get(user_info["status"]) != schemas.UserStatuses.OK # reset error messages/flags