# HG changeset patch # User Reimar Bauer # Date 1203701482 -3600 # Node ID 15d744f727c9bbd69e8331b175a90f11805096a2 # Parent 5471f4a009dced273f30cf9a50d611520377b319 UserPreferences 'send account data' also accepts username now (not only email addr), thanks to Joel Nackman (ported from 1.6) diff -r 5471f4a009dc -r 15d744f727c9 MoinMoin/action/recoverpass.py --- a/MoinMoin/action/recoverpass.py Fri Feb 22 18:11:05 2008 +0100 +++ b/MoinMoin/action/recoverpass.py Fri Feb 22 18:31:22 2008 +0100 @@ -18,12 +18,26 @@ Contact the owner of the wiki, who can enable email.""") try: email = wikiutil.clean_input(form['email'][0].lower()) + if not email: + raise KeyError # we raise KeyError if the string is empty except KeyError: - return _("Please provide a valid email address!") + try: + username = wikiutil.clean_input(form['name'][0]) + if not username: + raise KeyError + except KeyError: + return _("Please provide a valid email address!", formatted=False) + + u = user.User(self.request, user.getUserId(self.request, username)) + if u.valid: + is_ok, msg = u.mailAccountData() + if not is_ok: + return wikiutil.escape(msg) + return _("If an account with this username exists, an email was sent.", formatted=False) u = user.get_by_email_address(request, email) if u: - msg = u.mailAccountData() + is_ok, msg = u.mailAccountData() return wikiutil.escape(msg) return _("Found no account matching the given email address '%(email)s'!") % {'email': email} diff -r 5471f4a009dc -r 15d744f727c9 MoinMoin/user.py --- a/MoinMoin/user.py Fri Feb 22 18:11:05 2008 +0100 +++ b/MoinMoin/user.py Fri Feb 22 18:31:22 2008 +0100 @@ -1054,5 +1054,5 @@ formatted=False) % {'sitename': self._cfg.sitename or "Wiki"} mailok, msg = sendmail.sendmail(self._request, [self.email], subject, text, mail_from=self._cfg.mail_from) - return msg + return mailok, msg