Exemple #1
0
    def get(self):
        employee = AuthenticationModel.find_by_id(get_jwt_identity())
        if employee:
            employee.isAuthenticate = False
            employee.save_to_db()
            jti = get_raw_jwt()["jti"]
            blacklist.add(jti)

            attend = AttendanceModel.query.filter(
                and_(
                    AttendanceModel.date == datetime.today().strftime(
                        "%d/%m/%Y"),
                    AttendanceModel.emp_id == get_jwt_identity(),
                )).first()

            attend.endtime = datetime.now().strftime("%H:%M:%S")
            attend.save_to_db()

            return {
                "msg": "Successfully logged out",
                "authenticate": employee.isAuthenticate,
            }, 200
        else:
            return {"error": "error in logout"}
Exemple #2
0
def logout():
    jti = get_raw_jwt()['jti']
    blacklist.add(jti)
    return jsonify({"msg": "Successfully logged out"}), 200
 def on_add_to_bl():
     blacklist.add(current_item.title)
     current_item.is_in_blacklist = True
     current_item.emit_redraw_request()
Exemple #4
0
 def delete(cls):
     jti = get_raw_jwt()['jti']
     blacklist.add(jti)
     return {"msg": "Terminada a sessão com sucesso"}, 200
Exemple #5
0
 def post(self):
     jti = get_raw_jwt()['jti']
     blacklist.add(jti)
     return logout