Exemple #1
0
 def post(self):
     session = Session()
     self.logger.debug(self.get_argument("username"))
     if session.login(self.get_argument("username"), self.get_argument("password")):
         self.logger.debug("Valid username and password!")
         self.set_secure_cookie(settings.SESSION_COOKIE, str(session.__id__), expires_days=2)    
         self.logger.debug(settings.BASE_URL + "/" + self.get_argument("redirect", ""))
         self.redirect(settings.BASE_URL + "/" + self.get_argument("redirect", ""))
     else:
         self.logger.debug("BAD USERNAME and PASSWORD")
         self.redirect(settings.BASE_URL + "/login/")
Exemple #2
0
import system.util as util

logger.info('Starting %s version %s' % (settings.PROJECT, settings.VERSION))

conn[settings.ADMIN_DB]['change_log'].ensure_index([('reference.id',1), ('user', 1)])

conn[settings.ADMIN_DB]['users'].ensure_index([('username',1)], unique=True)

super = conn[settings.ADMIN_DB]['users'].find_one({'username':'******'})
if not super:
    super = User()
    super.username = '******'
    super.firstName = "Super"
    super.lastName = "Admin"
    super.status = "Active"
    super.password = super.encrypt_password('abudabu')
    print super.save()
    ses = Session()
    ses.user = super
    
    
    print super.__errors__


try:
    port = sys.argv[1]
except:
    port = settings.SERVER_PORT

s = Server(port=port)