예제 #1
0
def login():

    if 'name' in request.form and 'password' in request.form:
        try:
            authenticate(request.form['name'], request.form['password'])
            user_flask = FlaskUser(User(request.form['name']))
            login_user(user_flask, remember=False)
            # next_url = request.get('next_url', '/')
            return redirect("/")
        except Exception, e:
            traceback.print_exc(file=sys.stdout)
            return jsonify(message=e.message), 400
예제 #2
0
파일: public.py 프로젝트: metiqls/platform
def login():
    request_json = request.json
    if 'username' in request_json and 'password' in request_json:
        try:
            authenticate(request_json['username'], request_json['password'])
            user_flask = FlaskUser(User(request_json['username']))
            login_user(user_flask, remember=False)
            # next_url = request.get('next_url', '/')
            return redirect("/")
        except Exception as e:
            traceback.print_exc(file=sys.stdout)
            return jsonify(message=str(e)), 400

    return jsonify(message='missing name or password'), 400
예제 #3
0
def load_user(email):
    return FlaskUser(User(email))