Beispiel #1
0
def process_userinfo(user_info):
    curr = User()
    curr.id = user_info['sub']
    curr.username = user_info['name']
    if 'https://hackquarantine.com/user_metadata' in user_info:
        curr.student_status = bool(
            user_info['https://hackquarantine.com/user_metadata']
            ['student_status']) or False
    # only me, hacky but quick
    curr.admin = (user_info['sub'] == config.ADMIN_ID)
    return curr
Beispiel #2
0
 def setUpClass(self):
     u = User.objects(username="******", password="******")
     if len(u) > 0:
         u.delete()
     u = User()
     u.username = "******"
     u.password = "******"
     u.save()
     self.user = u
     now = datetime.datetime.now()
     r = Reservation.get_between(now, now + datetime.timedelta(days=1))
     r.delete()
Beispiel #3
0
def register_user():
    data = request.get_data()
    data = json.loads(data)
    username = data['username']
    password = data['password']
    users = User.objects(username=username, password=password)
    if len(users) > 0:
        return jsonify({'id': -1}), 409
    else:
        user = User()
        user.username = username
        user.password = password
        user.privilege = 0
        user.save()
        return jsonify(user.get_dict()), 201