comparison MoinMoin/themes/__init__.py @ 174:e8f61cbd661b

modularize crypto/random stuff, move it to MoinMoin.util.crypto, pw change bugfix on password change, the new password was not saved to the profile User / crypto code: minor optimizations / refactorings crypto module contents: password hashing/encryption, validation, pw hash upgrades: * pw_hash = crypt_password(password) * is_valid = valid_password(password, pw_hash) * upgraded_pw_hash = upgrade_password(password, pw_hash) password recovery: * key, token = generate_token() * is_valid = valid_token(key, token) random strings: * rs = random_string(length, chars) compute ascii cache keys: * key = cache_key(**kw)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 07 Apr 2011 20:56:35 +0200
parents d3deda1731fb
children 661a57c747bd
comparison
equal deleted inserted replaced
173:89f50aed143f 174:e8f61cbd661b
20 20
21 from MoinMoin.i18n import _, L_, N_ 21 from MoinMoin.i18n import _, L_, N_
22 from MoinMoin import wikiutil, user 22 from MoinMoin import wikiutil, user
23 from MoinMoin.config import USERID, ADDRESS, HOSTNAME 23 from MoinMoin.config import USERID, ADDRESS, HOSTNAME
24 from MoinMoin.util.interwiki import split_interwiki, resolve_interwiki, join_wiki, getInterwikiHome 24 from MoinMoin.util.interwiki import split_interwiki, resolve_interwiki, join_wiki, getInterwikiHome
25 from MoinMoin.util.crypto import cache_key
25 26
26 27
27 def get_current_theme(): 28 def get_current_theme():
28 # this might be called at a time when flaskg.user is not setup yet: 29 # this might be called at a time when flaskg.user is not setup yet:
29 u = getattr(flaskg, 'user', None) 30 u = getattr(flaskg, 'user', None)
218 # Add sister pages (see http://usemod.com/cgi-bin/mb.pl?SisterSitesImplementationGuide ) 219 # Add sister pages (see http://usemod.com/cgi-bin/mb.pl?SisterSitesImplementationGuide )
219 for sistername, sisterurl in self.cfg.sistersites: 220 for sistername, sisterurl in self.cfg.sistersites:
220 if sistername == self.cfg.interwikiname: # it is THIS wiki 221 if sistername == self.cfg.interwikiname: # it is THIS wiki
221 items.append(('sisterwiki current', sisterurl, sistername)) 222 items.append(('sisterwiki current', sisterurl, sistername))
222 else: 223 else:
223 cid = wikiutil.cache_key(usage="SisterSites", sistername=sistername) 224 cid = cache_key(usage="SisterSites", sistername=sistername)
224 sisteritems = app.cache.get(cid) 225 sisteritems = app.cache.get(cid)
225 if sisteritems is None: 226 if sisteritems is None:
226 uo = urllib.URLopener() 227 uo = urllib.URLopener()
227 uo.version = 'MoinMoin SisterItem list fetcher 1.0' 228 uo.version = 'MoinMoin SisterItem list fetcher 1.0'
228 try: 229 try: