def identify(): if is_logged(): user = UserService().get_by_id(flask.session['user_id']) if user is not None: return flask.jsonify(user.to_dic()) flask.session.pop('user_id', None) return '', 403
def login(): user = UserService().get_by_log(flask.request.form["username"], flask.request.form["password"]) if user is not None: flask.session['user_id'] = user.id flask.session.pop('board_id', None) return flask.jsonify(user.to_dic()) flask.session.pop('user_id', None) return '', 403
def register(): user = UserService().add(flask.request.form["username"], flask.request.form["email"], flask.request.form["password"]) # TODO board = BoardService().add(db.Session(), name, user) if user is not None: return flask.jsonify(user.to_dic()) return flask.jsonify(identified=False)