~ubuntu-branches/ubuntu/gutsy/moin/gutsy

« back to all changes in this revision

Viewing changes to MoinMoin/user.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
933
933
 
934
934
    def mailAccountData(self, cleartext_passwd=None):
935
935
        from MoinMoin.util import mail
 
936
        from MoinMoin.wikiutil import getSysPage
936
937
        _ = self._request.getText
937
938
 
 
939
        if not self.enc_password: # generate pw if there is none yet
 
940
            from random import randint
 
941
            import base64
 
942
    
 
943
            charset = 'utf-8'
 
944
            pwd = "%s%d" % (str(time.time()), randint(0, 65535))
 
945
            pwd = pwd.encode(charset)
 
946
 
 
947
            pwd = sha.new(pwd).digest()
 
948
            pwd = '{SHA}%s' % base64.encodestring(pwd).rstrip()
 
949
    
 
950
            self.enc_password = pwd
 
951
            self.save()
 
952
 
938
953
        text = '\n' + _("""\
939
954
Login Name: %s
940
955
 
941
956
Login Password: %s
942
957
 
943
 
Login URL: %s/?action=userform&uid=%s
 
958
Login URL: %s/%s
944
959
""", formatted=False) % (
945
 
                        self.name, self.enc_password, self._request.getBaseURL(), self.id)
 
960
                        self.name, self.enc_password, self._request.getBaseURL(), getSysPage(self._request, 'UserPreferences').page_name)
946
961
 
947
962
        text = _("""\
948
963
Somebody has requested to submit your account data to this email address.
960
975
        mailok, msg = mail.sendmail(self._request, [self.email], subject,
961
976
                                    text, mail_from=self._cfg.mail_from)
962
977
        return msg
963
 
        
 
978