def editSiteUser(form): postID = form.getfirst("postID", "none") if postID == "none": theUser = algaeModels.siteUser() else: theUser = algaeModels.siteUser.get(postID) theUser.userName = form.getfirst("userName", "nobody").decode( 'utf-8', 'ignore') theUser.displayName = form.getfirst("displayName", "Nobody").decode( 'utf-8', 'ignore') theUser.userEmail = form.getfirst("userEmail", "*****@*****.**").decode( 'utf-8', 'ignore') theUser.role = form.getfirst("role", "author") theUser.saltedPwd = hashlib.md5(form.getfirst("pWord", "badPassword") + algaeUserConfig.passSalt).hexdigest() theUser.put() print "Location: admin?saved=yes&edit=siteUser" print 'Content-Type: text/html\n'
def verifiedUser(username): userQuery = db.GqlQuery("SELECT * FROM siteUser WHERE userName = '******'") user = userQuery.get() if user: return True elif username == algaeUserConfig.rootUserName: # this is to initialize a user in the datastore for the root user. rootUser = algaeModels.siteUser() rootUser.userName = algaeUserConfig.rootUserName rootUser.displayName = algaeUserConfig.rootDisplayName rootUser.saltedPwd = hashlib.md5(algaeUserConfig.rootPassword + algaeUserConfig.passSalt).hexdigest() rootUser.userEmail = algaeUserConfig.rootEmail rootUser.role = 'admin' rootUser.put() return True return False
def editSiteUser(form): postID = form.getfirst("postID", "none") if postID == "none": theUser = algaeModels.siteUser() else: theUser = algaeModels.siteUser.get(postID) theUser.userName = form.getfirst("userName", "nobody").decode('utf-8', 'ignore') theUser.displayName = form.getfirst("displayName", "Nobody").decode('utf-8', 'ignore') theUser.userEmail = form.getfirst("userEmail", "*****@*****.**").decode( 'utf-8', 'ignore') theUser.role = form.getfirst("role", "author") theUser.saltedPwd = hashlib.md5( form.getfirst("pWord", "badPassword") + algaeUserConfig.passSalt).hexdigest() theUser.put() print "Location: admin?saved=yes&edit=siteUser" print 'Content-Type: text/html\n'