~ubuntu-branches/ubuntu/saucy/prewikka/saucy-proposed

« back to all changes in this revision

Viewing changes to prewikka/modules/auth/loginpassword/loginpassword.py

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2009-06-14 10:00:20 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090614100020-479f60e0m8ae7hq0
Tags: 0.9.15-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
class MyLoginPasswordAuth(Auth.LoginPasswordAuth):
26
26
    def __init__(self, env, config):
 
27
        user = config.getOptionValue("initial_admin_user", User.ADMIN_LOGIN)
 
28
        passwd = config.getOptionValue("initial_admin_pass", User.ADMIN_LOGIN)
 
29
 
27
30
        expiration = int(config.getOptionValue("expiration", 60)) * 60
28
31
        Auth.LoginPasswordAuth.__init__(self, env, expiration)
29
32
 
35
38
                break
36
39
 
37
40
        if not has_user_manager:
38
 
            if not self.db.hasUser(User.ADMIN_LOGIN):
39
 
                self.db.createUser(User.ADMIN_LOGIN)
40
 
 
41
 
            if not self.db.hasPassword(User.ADMIN_LOGIN):
42
 
                self.setPassword(User.ADMIN_LOGIN, User.ADMIN_LOGIN)
43
 
 
44
 
            self.db.setPermissions(User.ADMIN_LOGIN, User.ALL_PERMISSIONS)
 
41
            if not self.db.hasUser(user):
 
42
                self.db.createUser(user)
 
43
 
 
44
            if not self.db.hasPassword(user):
 
45
                self.setPassword(user, passwd)
 
46
 
 
47
            self.db.setPermissions(user, User.ALL_PERMISSIONS)
45
48
 
46
49
    def _hash(self, data):
47
50
        return md5.new(data).hexdigest()