Example #1
0
    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)
Example #2
0
    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)
Example #3
0
File: user.py Project: astex/fable
    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)
Example #4
0
    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)
Example #5
0
 def index(self):
     if not session:
         return self.json({})
     return self.json(session.get_dictionary())
Example #6
0
 def index(self):
     return self.json(session.get_dictionary())
Example #7
0
 def index(self):
     return self.json(session.get_dictionary())