Commit b44d2aee authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

backport stable

......@@ -3,3 +3,5 @@ f61562fcf20e0fd3b7821fb9173d75398ee5c3bb 0.1.0
3bc850d3841e533fb5f9d8919b1abe160935130e cubicweb-forgotpwd-debian-version-0.1.0-2
ddff1a3f5cd300656e99f3142eab7893b7f33199 cubicweb-forgotpwd-version-0.2.0
efd6fc25d255a2a3fbe8aeb89121f44f6a297b69 cubicweb-forgotpwd-debian-version-0.2.0-1
19ea4ec2c3325165e71dccb55bb9077f6a24cf01 cubicweb-forgotpwd-version-0.2.1
ee818e5326db7397d485a64f76644765c4652df8 cubicweb-forgotpwd-debian-version-0.2.1-1
......@@ -4,7 +4,7 @@
modname = 'forgotpwd'
distname = 'cubicweb-forgotpwd'
numversion = (0, 2, 0)
numversion = (0, 2, 1)
version = '.'.join(str(num) for num in numversion)
license = 'LCL'
......
cubicweb-forgotpwd (0.2.1-1) unstable; urgency=low
* new upstream release
-- Sylvain Thénault <sylvain.thenault@logilab.fr> Tue, 16 Mar 2010 16:38:47 +0100
cubicweb-forgotpwd (0.2.0-1) unstable; urgency=low
* new upstream release
......
......@@ -10,7 +10,7 @@ Homepage: http://www.cubicweb.org/project/cubicweb-forgotpwd
Package: cubicweb-forgotpwd
Architecture: all
Depends: cubicweb-common (>= 3.6.1), python-crypto, python-imaging
Description: password recovery cube
Description: password recovery component for the CubicWeb framework
This CubicWeb component provides password recovery functionnality.
.
CubicWeb is a semantic web application framework, see http://www.cubicweb.org
......@@ -50,7 +50,7 @@ See you soon on %(base_url)s !
return self._cw._(u'Request to change your password')
def recipients(self):
fpasswd = self._cw.rset.get_entity(self.cw_row or 0, self.cw_col or 0)
fpasswd = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
user = fpasswd.reverse_has_fpasswd[0]
return [(user.get_email(), user.property_value('ui.language'))]
......
......@@ -31,9 +31,11 @@ class LogFormView(basetemplates.LogFormView):
super(LogFormView, self).login_form(id)
self._cw.add_css('cubes.forgotpwd.css')
self.w(u'<span class="forgotpwdLink"><a href="%s">%s</a></span>' % (
xml_escape(self._cw.build_url('forgottenpassword')),
xml_escape(self._cw.build_url('forgottenpassword',
base_url=self._cw.vreg.config['base-url'])),
self._cw._('Forgot your password ?')))
# First form, send an email
# -------------------------
......@@ -50,6 +52,7 @@ class ForgottenPasswordForm(forms.FieldsForm):
label=_('captcha'),
help=_('please copy the letters from the image'))
class ForgottenPasswordFormView(form.FormViewMixIn, StartupView):
__regid__ = 'forgottenpassword'
......@@ -71,7 +74,7 @@ class ForgottenPasswordSendMailController(controller.Controller):
msg = str(exc)
else:
msg = self._cw._(u'An email has been sent, follow instructions in there to change your password.')
raise Redirect(self.build_url('pwdsent', __message=msg))
raise Redirect(self._cw.build_url('pwdsent', __message=msg))
def checked_data(self):
'''only basic data check here (required attributes and password
......@@ -102,6 +105,7 @@ class PasswordSentView(StartupView):
def call(self):
self.wview('index', self.cw_rset)
# Second form, ask for a new password
# -----------------------------------
......@@ -142,7 +146,7 @@ class ForgottenPasswordRequestConfirm(controller.Controller):
def publish(self, rset=None):
data = self.checked_data()
msg = self.appli.repo.forgotpwd_change_passwd(data)
raise Redirect(self.build_url('pwdreset', __message=msg))
raise Redirect(self._cw.build_url('pwdreset', __message=msg))
def checked_data(self):
cw = self._cw
......@@ -203,6 +207,7 @@ def forgotpwd_send_email(self, data):
finally:
session.close()
@monkeypatch(Repository)
def forgotpwd_change_passwd(self, data):
session = self.internal_session()
......@@ -228,6 +233,7 @@ def forgotpwd_change_passwd(self, data):
finally:
session.close()
# URL rewriting
# -------------
......
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