comparison libervia/pages/register/page_meta.py @ 1404:6a35167a4e2c

pages (login, register): fix `allow_registration`: if `allow_registration` is false: - `register_url` is not set in login page - register page returns HTTP_FORBIDDEN
author Goffi <goffi@goffi.org>
date Fri, 16 Apr 2021 18:38:45 +0200
parents f511f8fbbf8a
children ce879da7fcf7
comparison
equal deleted inserted replaced
1403:1357d04107d1 1404:6a35167a4e2c
14 access = C.PAGES_ACCESS_PUBLIC 14 access = C.PAGES_ACCESS_PUBLIC
15 template = "login/register.html" 15 template = "login/register.html"
16 16
17 17
18 def prepare_render(self, request): 18 def prepare_render(self, request):
19 if not self.host.options["allow_registration"]:
20 self.pageError(request, C.HTTP_FORBIDDEN)
19 profile = self.getProfile(request) 21 profile = self.getProfile(request)
20 if profile is not None: 22 if profile is not None:
21 self.pageRedirect("/login/logged", request) 23 self.pageRedirect("/login/logged", request)
22 template_data = request.template_data 24 template_data = request.template_data
23 template_data["login_url"] = self.getPageByName("login").url 25 template_data["login_url"] = self.getPageByName("login").url