def decorated_view(*args, **kwargs): if not current_user.is_authenticated() or not session.get("user_id_local"): return redirect(url_for("Home")) # User must have the required roles if not current_user.has_roles(*required_roles): # Redirect to the unauthorized page return redirect(url_for("server_Unauthorized")) # Call the actual view return func(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated() or not session.get('user_id'): flash('Connectez-vous SVP.', 'danger') return redirect(url_for('home.index')) # User must have the required roles if not current_user.has_roles(required_roles, required_droits): # Redirect to the unauthorized page return redirect(url_for('server_Unauthorized')) # Call the actual view return func(*args, **kwargs)
def decorated_view(*args, **kwargs): # User must be logged if not current_user.is_authenticated(): # Redirect to the unauthenticated page return current_app.user_manager.unauthenticated_view_function() # User must have the required roles if not current_user.has_roles(*required_roles): # Redirect to the unauthorized page return current_app.user_manager.unauthorized_view_function() # Call the actual view return func(*args, **kwargs)
def decorated_view(*args, **kwargs): # User must be logged if not current_user.is_authenticated(): # Redirect to the unauthenticated page return current_app.user_manager.unauthenticated_view_function() # User must have the required roles if not current_user.has_roles(*role_names): # Redirect to the unauthorized page return current_app.user_manager.unauthorized_view_function() # Call the actual view return func(*args, **kwargs)
def decorated_view(*args, **kwargs): if not current_user.is_authenticated() or not session.get( 'user_id'): flash('Connectez-vous SVP.', 'danger') return redirect(url_for('home.index')) # User must have the required roles if not current_user.has_roles(required_roles, required_droits): # Redirect to the unauthorized page return redirect(url_for('server_Unauthorized')) # Call the actual view return func(*args, **kwargs)
def decorated_view(*args, **kwargs): if current_user.is_active() is False: flash('SVP confirmez votre compte!', 'warning') return redirect(url_for('user_param.unconfirmed')) if not current_user.is_authenticated() or not session.get( 'user_id'): flash('Connectez-vous SVP.', 'danger') return redirect(url_for('user.logout')) if not current_user.is_authenticated() and session.get('user_id'): flash('Connectez-vous SVP.', 'danger') return redirect(url_for('user.logout')) # User must have the required roles if not current_user.has_roles(required_roles, required_droits): # Redirect to the unauthorized page return redirect(url_for('server_Unauthorized')) # Call the actual view return func(*args, **kwargs)