def delete(args): if args['data'] != None: try: user_names = models.auth_user_info().aggregate().project(username = 1).match("_id in {0}", [ObjectId(x["_id"])for x in args['data']]).get_list() models.auth_user().delete("username in {0}", [x["username"] for x in user_names]) ret = models.auth_user_info().delete("_id in {0}", [ObjectId(x["_id"])for x in args['data']]) return ret except Exception as ex: logger.debug(ex) return dict( error = ex.message ) return dict( error = "request parameter is not exist" )
def delete(args): if args['data'] != None: try: user_names = models.auth_user_info().aggregate().project(username = 1).match("_id in {0}", [ObjectId(x["_id"])for x in args['data']]).get_list() models.auth_user().delete("username in {0}", [x["username"] for x in user_names]) ret = models.auth_user_info().delete("username in {0}", [x["username"]for x in args['data']]) return ret except Exception as ex: logger.debug(ex) return dict( error = ex.message ) return dict( error = "request parameter is not exist" )
def login(): username=request.form.get('username','') password=request.form.get('password','') result=models.auth_user(username,password) if result: session['user']=username return redirect('/users/') else: return render_template('index.html',username=username,password=password,error='Name or password errror, or name was locked.')
def login(): username = request.form.get('username') password = request.form.get('password') if models.auth_user(username,password): session['user'] = {'username':username} return redirect('/users') if username != "" and models.exist_user(username): return render_template('index.html',usererror="用户不存在") else: return render_template('index.html',loginerror="用户名或密码错误")
def login(): username = request.form.get('username') password = request.form.get('password') if models.auth_user(username, password): session['user'] = {'username': username} return redirect('/users') if username != "" and models.exist_user(username): return render_template('index.html', usererror="用户不存在") else: return render_template('index.html', loginerror="用户名或密码错误")
def register(): try: data = request.get_json() create_user(data["username"], data["email"], data["password"]) res = auth_user(data["username"], data["password"]) return jsonify({ "msg": f'{data["username"]}', "id": res, "token": jwt_user(data["username"]) }) except Exception as e: return jsonify({'msg': f'{e}'}), 401
def login(): username = request.form.get('username', '') password = request.form.get('password', '') result = models.auth_user(username, password) if result: return redirect('/rooms/') else: return render_template( 'index.html', username=username, password=password, error='name or password errror. or your name was locked.')
def login(): if request.method == 'POST': data = request.get_json() res = auth_user(data["username"], data["password"]) if res: return jsonify({ "msg": f'{data["username"]}', "id": res, "token": jwt_user(data["username"]) }) else: return jsonify({ 'msg': f'{res}', }), 401
def login(): username = '' password = '' if request.method == 'POST': username = request.form.get('username', '') password = request.form.get('password', '') else: username = request.args.get('username', '') password = request.args.get('password', '') user = models.auth_user(username, password) if user: return redirect('/users/') else: return render_template( 'index.html', username=username, error='username or password error,or user was locked.')