Commit 306c5386 authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[views] Put the 'forgot password ?' link inside the LogForm

The old highjack of the LogFormView fails miserably when the bootstrap
cube is used.  Putting the link inside a fake FieldWidget inside the
form yields good results.  Closes #5190006.
parent 4aa3a4994640
......@@ -21,15 +21,18 @@ _ = unicode
# Login form
# ----------
class LogFormView(basetemplates.LogFormView):
def login_form(self, *args, **kwargs):
super(LogFormView, self).login_form(*args, **kwargs)
self.w(u'<span class="forgotpwdLink"><a href="%s">%s</a></span>' % (
xml_escape(self._cw.build_url('forgottenpassword',
base_url=self._cw.vreg.config['base-url'])),
self._cw._('Forgot your password?')))
class ForgotPasswordLinkWidget(wdg.FieldWidget):
def render(self, form, field, renderer):
req = form._cw
ret = u'<span class="forgotpwdLink"><a href="%s">%s</a></span>' % (
xml_escape(req.build_url('forgottenpassword',
base_url=req.vreg.config['base-url'])),
req._('Forgot your password?'))
return ret
basetemplates.LogForm.append_field(
ff.Field(name='__forgotpwd', label=None, widget=ForgotPasswordLinkWidget)
)
# First form, send an email
# -------------------------
......@@ -186,10 +189,3 @@ class RegistrationSimpleReqRewriter(urlrewrite.SimpleReqRewriter):
('/pwdsent', dict(vid='pwdsent')),
('/pwdreset', dict(vid='pwdreset')),
]
# Registration
# ------------
def registration_callback(vreg):
vreg.register_all(globals().values(), __name__, (LogFormView,))
vreg.register_and_replace(LogFormView, basetemplates.LogFormView)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment