Esempio n. 1
0
def adduser(username,itcode,department,team,email,role):
    user = User(name = username,
                role = role,
                itcode = itcode,
                department = department,
                team = team,
                email = email,
                password = md5(default_user_password))
    session.add(user)
    session.flush()
    session.commit()
Esempio n. 2
0
def login(itcode,password):
    query = session.query(User)
    user = query.filter_by(itcode = itcode).first()
    if user :
        db_password = user.password
        if md5(password) == db_password:
            return True,user
        else:
            return False,user
    else:
        return False