Ejemplo n.º 1
0
def api_login():
    id = request.json['id']
    password = request.json['password']

    data = OrderedDict()

    db = DB()
    flag = db.id_check(id)

    if flag == 0:
        data['status'] = 'id not found'
        return jsonify(data)

    user_buf = db.login(id, password)
    del db

    if user_buf:
        data['status'] = 'ok'
        data['id'] = user_buf.id
        data['permission'] = user_buf.permission

        return jsonify(data)
    else:
        data['status'] = 'password wrong'
        return jsonify(data)
Ejemplo n.º 2
0
def Check_id():
    id = request.args.get('id', 0)
    if id == "error" or\
    id == "Error" or \
    id == "Admin" or \
    id == "admin" or \
    id == "Manager" or\
    id == "manager" :
        return render_template('alert_msg.html', msg="사용할수 없는 id 입니다.")
    mydb = DB()
    count = int(mydb.id_check(id))

    data = OrderedDict()
    data['count'] = count
    return jsonify(data)