def post(self): user = db.session.query(User).filter(User.name == request.GET.get('name')).first() if not user: raise Unauthorized if not check_password(user): raise Unauthorized session.clear() session['user_id'] = user.id_ return self.json(session.get_dictionary(), 201)
def post(self): user = db.session.query(User).filter( User.name == request.GET.get('name')).first() if not user: raise Unauthorized if not check_password(user): raise Unauthorized session.clear() session['user_id'] = user.id_ return self.json(session.get_dictionary(), 201)
def post(self): form = SessionForm(**request.json) if not form.validate(): raise BadRequest(form.errors) user = (db.session.query(User) .filter(User.email == form.email.data) .first()) session.clear() session['user_id'] = user.id session.permanent = True return self.json(session.get_dictionary(), 201)
def post(self): user = db.session.query(User).filter( User.email == request.json.get('email') ).first() if not user: raise Unauthorized if not user.check_password(request.json.get('password')): raise Unauthorized session.clear() session['user_id'] = user.id_ session.permanent = True return self.json(session.get_dictionary(), 201)
def index(self): if not session: return self.json({}) return self.json(session.get_dictionary())
def index(self): return self.json(session.get_dictionary())