""" Return the md5 hash of the password+salt """ salted_password = password + app.secret_key return md5(salted_password).hexdigest() # Load configuration from file configfile = "/opt/inkscope/etc/inkscope.conf" datasource = open(configfile, "r") conf = json.load(datasource) datasource.close() # control inkscope users collection in mongo db = mongoJuiceCore.getClient(conf, 'inkscope') if db.inkscope_users.count() == 0: print "list users is empty: populating with default users" user = {"name":"admin", "password": hash_pass("admin"), "roles":["admin"]} db.inkscope_users.insert(user) user = {"name":"guest", "password": hash_pass(""), "roles":["supervizor"]} db.inkscope_users.insert(user) # # Security #
def hash_pass(password): """ Return the md5 hash of the password+salt """ salted_password = password + app.secret_key return md5(salted_password).hexdigest() # Load configuration from file configfile = "/opt/inkscope/etc/inkscope.conf" datasource = open(configfile, "r") conf = json.load(datasource) datasource.close() # control inkscope users collection in mongo db = mongoJuiceCore.getClient(conf, 'inkscope') if db.inkscope_users.count() == 0: print "list of users is empty: populating with default users" user = { "name": "admin", "password": hash_pass("admin"), "roles": ["admin"] } db.inkscope_users.insert(user) user = { "name": "guest", "password": hash_pass(""), "roles": ["supervizor"] } db.inkscope_users.insert(user)