From 47cd8ee277b12aa3fe6867fe308672c4e3996c65 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Fri, 27 Jul 2012 11:01:35 +0200 Subject: [PATCH] [gen] Add param Config.activateForgotPassword to allow to disable this functionality for sites where the email of users may be unknown. --- gen/__init__.py | 2 ++ gen/generator.py | 1 + gen/mixins/ToolMixin.py | 4 ++++ gen/templates/config.pyt | 1 + gen/ui/template.pt | 6 +++--- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gen/__init__.py b/gen/__init__.py index 28c5d38..88e6246 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -2894,6 +2894,8 @@ class Config: # Language that will be used as a basis for translating to other # languages. self.sourceLanguage = 'en' + # Activate or not the button on home page for asking a new password + self.activateForgotPassword = True # When using Ogone, place an instance of appy.gen.ogone.OgoneConfig in # the field below. self.ogone = None diff --git a/gen/generator.py b/gen/generator.py index 1f56ee3..8adc831 100644 --- a/gen/generator.py +++ b/gen/generator.py @@ -728,6 +728,7 @@ class ZopeGenerator(Generator): repls['languageSelector'] = self.config.languageSelector repls['sourceLanguage'] = self.config.sourceLanguage repls['ogone'] = repr(self.config.ogone) + repls['activateForgotPassword'] = self.config.activateForgotPassword self.copyFile('config.pyt', repls, destName='config.py') def generateInit(self): diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 1028d49..0990308 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -113,6 +113,10 @@ class ToolMixin(BaseMixin): page = self.REQUEST.get('ACTUAL_URL').split('/')[-1] return page not in ('edit', 'query', 'search', 'do') + def showForgotPassword(self): + '''We must show link "forgot password?" when the app requires it.''' + return self.getProductConfig().activateForgotPassword + def getLanguages(self): '''Returns the supported languages. First one is the default.''' return self.getProductConfig().languages diff --git a/gen/templates/config.pyt b/gen/templates/config.pyt index 6bffade..d4a5041 100644 --- a/gen/templates/config.pyt +++ b/gen/templates/config.pyt @@ -47,6 +47,7 @@ grantableRoles = [] languages = [] languageSelector = sourceLanguage = '' +activateForgotPassword = ogone = # When Zope is starting or runs in test mode, there is no request object. We diff --git a/gen/ui/template.pt b/gen/ui/template.pt index 8c02cac..da3ab80 100644 --- a/gen/ui/template.pt +++ b/gen/ui/template.pt @@ -97,8 +97,8 @@ - Popup for reinitialing the password -