Ejemplo n.º 1
0
 def login(self, username, password):
     self.logger.debug("LOGIN")
     users = User.find({'username':username})
     if users.count():
         for user in users:
             valid = user.check_password(password)
             self.logger.debug("VALID: %s" % valid)
             if valid and user.status == 'Active':
                 self.user = user.__id__
                 return self.create_session()
     return False
Ejemplo n.º 2
0
def create_user():
    user = User('Joe', 'Doe')
    return user
Ejemplo n.º 3
0
def test_create_user():
    user1 = User('John', 'Nowak')
    assert user1.first_name == "John"
    assert user1.email == "*****@*****.**"
Ejemplo n.º 4
0
 def add_users(self):
     self.create_names()
     for name in self.names:
         user = User(name[0], name[1])
         self.list_of_users.append(user)
Ejemplo n.º 5
0
humsettings.LOGGER = settings.get_logger

from system.server import Server
from system.session import Session
from system.user import User
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]