def update_user_data( self, user, token ): dao = UserDAO() db_user = dao.get_by_username( user.username ) token_expiration_date = self.calculate_token_expiration_date() if db_user is not None: dao.update_auth_by_id( db_user.id, token, token_expiration_date ) else: dao.create_with_auth( user, token, token_expiration_date )