[gen] Add param Config.activateForgotPassword to allow to disable this functionality for sites where the email of users may be unknown.
This commit is contained in:
parent
b2e1e8c780
commit
47cd8ee277
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,6 +47,7 @@ grantableRoles = [<!grRoles!>]
|
|||
languages = [<!languages!>]
|
||||
languageSelector = <!languageSelector!>
|
||||
sourceLanguage = '<!sourceLanguage!>'
|
||||
activateForgotPassword = <!activateForgotPassword!>
|
||||
ogone = <!ogone!>
|
||||
|
||||
# When Zope is starting or runs in test mode, there is no request object. We
|
||||
|
|
|
@ -97,8 +97,8 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<tal:comment replace="nothing">Popup for reinitialing the password</tal:comment>
|
||||
<div id="askPasswordReinitPopup" class="popup" tal:condition="isAnon">
|
||||
<tal:comment replace="nothing">Popup for reinitializing the password</tal:comment>
|
||||
<div id="askPasswordReinitPopup" class="popup" tal:condition="python: isAnon and tool.showForgotPassword()">
|
||||
<form id="askPasswordReinitForm" method="post"
|
||||
tal:attributes="action python: tool.absolute_url() + '/askPasswordReinit'">
|
||||
<div align="center">
|
||||
|
@ -141,7 +141,7 @@
|
|||
tal:define="label python: _('app_connect')" tal:attributes="value label; alt label;"/>
|
||||
</form>
|
||||
</td>
|
||||
<td class="lostPassword">
|
||||
<td class="lostPassword" tal:condition="tool/showForgotPassword">
|
||||
<a href="javascript: openPopup('askPasswordReinitPopup')"
|
||||
tal:content="python: _('forgot_password')"></a></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue