Exemple #1
0
def remove_device():
    if 'userId' not in session:
        abort(403)

    user_id = session['userId']
    device_id = request.args.get('device')

    User.objects(pk=user_id).update_one(pull__devices={'deviceId': device_id})
    return redirect("/user/" + user_id)
Exemple #2
0
def send(uid, data):
    if contains(uid, "@"):
        user = User.objects(email=uid.lower()).first()
        if user is not None and len(user.devices) > 0:
            Glass.send_mirror(user, data)
            return send_to_user(user, data)
        else:
            return send_invitation(None, uid, None, data)
    else:
        user = User.objects(pk=uid).first()
        if user is not None and len(user.devices) > 0:
            Glass.send_mirror(user, data)
            return send_to_user(user, data)
        else:
            return send_invitation(None, user.email, None, data)
Exemple #3
0
def admin_users():
    authorize()
    users = User.objects()
    return render_template("admin_index.html", users=users)
Exemple #4
0
def getUser(uid):
    if contains(uid, "@"):
        return User.objects(email=uid.lower()).first()
    else:
        return User.objects(pk=uid).first()