Beispiel #1
0
    def get(self, user_id):
        user = UsuarioModel.find(user_id)

        if user:
            return user.json(), 200

        return {'message': 'User not found.'}, 404
Beispiel #2
0
 def delete(self, user_id):
     user = UsuarioModel.find(user_id)
     if user is None:
         return errors._NOT_FOUND, server_code.NOT_FOUND
     try:
         user.delete()
     except:
         return errors._DELETE_ERROR, server_code.INTERNAL_SERVER_ERROR
     return success._DELETED, server_code.OK
Beispiel #3
0
    def delete(self, user_id):
        user = UsuarioModel.find(user_id)
        if user:
            try:
                user.delete()
                return {'message': 'User deleted.'}, 200
            except:
                return {"message":"An internal error ocurred trying to delete 'User'."}, 500

        return {'message': 'User not found.'}, 404
Beispiel #4
0
 def get(cls, user_id):
     user = UsuarioModel.find(user_id)
     if user is None:
         return errors._NOT_FOUND, server_code.NOT_FOUND
     user.ativado = True
     try:
         user.save()
         headers = {"Content-Type":"text/html"}
         return make_response(render_template('confirm.html', email=user.email, login=user.login), 200, headers)
     except:
         return errors._SAVE_ERROR, server_code.INTERNAL_SERVER_ERROR
Beispiel #5
0
    def get(cls, user_id):
        user = UsuarioModel.find(user_id)
        if user:
            try:
                user.ativado = True
                user.save()
                return {'message': 'User cofirmed!'}, 200
            except:
                return {"message":"An internal error ocurred trying to confirme email from 'User'."}, 500

        return {'message': 'User not found.'}, 404
Beispiel #6
0
 def get(self, user_id):
     user = UsuarioModel.find(user_id)
     if user is None:
         return errors._NOT_FOUND
     return user.json(), server_code.OK