Beispiel #1
0
 def post(self):
   jti = get_raw_jwt()['jti']
   try:
     revoked_token = RevokedTokenModel(jti=jti)
     revoked_token.add()
     return {'message': 'Access token has been revoked'}
   except Exception as e:
     return {'message': 'Something went wrong {}'.format(e)}, 500
Beispiel #2
0
 def post(self):
     jti = get_raw_jwt()['jti']
     try:
         revoked_token = RevokedTokenModel(jti=jti)
         revoked_token.add()
         return {'message': 'Refresh token has been revoked'}
     except:
         return {'message': 'Something went wrong'}, 500
 def post(self):
     jti = get_raw_jwt()['jti']
     try:
         revoked_token = RevokedTokenModel(jti=jti)
         revoked_token.add()
         return {'mensagem': 'Refresh Token foi revogado'}
     except:
         return {'mensagem': 'Ocorreu um erro interno'}, 500
Beispiel #4
0
 def post(self):
     jti = get_raw_jwt()['jti']
     try:
         revoked_token = RevokedTokenModel(jti=jti)
         revoked_token.add()
         return {'message': 'Successful Loged Out'}, 200
     except:
         return {'message': 'Something went wrong'}, 500
Beispiel #5
0
 def post(self):
     try:
         jti = get_raw_jwt()['jti']
         email_address = get_jwt_identity()
         user_info = UserModel.find_by_email(email_address)
         session_id = UserSessionModel.find_by_id_and_time_out(user_info.id).session_id
         time_out = UserSessionModel.find_by_session_id(session_id)
         time_out.session_time_out = str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
         db.session.commit()
         revoked_token = RevokedTokenModel(jti=jti)
         revoked_token.add()
         session_info = UserSessionModel.find_by_user_id(user_info.id)
         return {
             'message': 'User Logged out',
             'user_Details': {
                 'email_address': email_address,
                 'first_name': user_info.first_name,
                 'last_name': user_info.last_name,
                 'time_in': session_info.session_time_in.strftime('%Y-%m-%d %H:%M:%S'),
                 'time_out': session_info.session_time_out.strftime('%Y-%m-%d %H:%M:%S')
             }
         }
     except AttributeError:
         return {'message': 'You are not logged in, Kindly Logged in'}, 401
    def post(self):
        jti = get_raw_jwt()['jti']

        revoked_token = RevokedTokenModel(jti=jti)
        revoked_token.add()
        return {'message': 'Refresh Token is revoked'}
Beispiel #7
0
 def post(self):
     jti = get_raw_jwt()['jti']
     revoked_token = RevokedTokenModel(jti=jti)
     revoked_token.add()
     return {"message": "Successfully logged  out"}, 200