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
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
def load_user(email): return FlaskUser(User(email))