[ 'message' => 'IP address successfully added to whitelist.', 'type' => self::TYPE_SUCCESS, 'dismissible' => true ], 'WHITELIST_ADD_ERROR' => [ 'message' => 'Failed to add IP to whitelist. Please check the IP format.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'WHITELIST_REMOVE_SUCCESS' => [ 'message' => 'IP address successfully removed from whitelist.', 'type' => self::TYPE_SUCCESS, 'dismissible' => true ], 'WHITELIST_REMOVE_ERROR' => [ 'message' => 'Failed to remove IP from whitelist.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'BLACKLIST_ADD_SUCCESS' => [ 'message' => 'IP address successfully added to blacklist.', 'type' => self::TYPE_SUCCESS, 'dismissible' => true ], 'BLACKLIST_ADD_ERROR' => [ 'message' => 'Failed to add IP to blacklist. Please check the IP format.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'BLACKLIST_REMOVE_SUCCESS' => [ 'message' => 'IP address successfully removed from blacklist.', 'type' => self::TYPE_SUCCESS, 'dismissible' => true ], 'BLACKLIST_REMOVE_ERROR' => [ 'message' => 'Failed to remove IP from blacklist.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'IP_REQUIRED' => [ 'message' => 'IP address is required.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'PERMISSION_DENIED' => [ 'message' => 'You do not have permission to perform this action.', 'type' => self::TYPE_ERROR, 'dismissible' => false ], 'RATE_LIMIT_INFO' => [ 'message' => 'Rate limiting is active. This helps protect against brute force attacks.', 'type' => self::TYPE_INFO, 'dismissible' => false ] ]; const LOGIN = [ 'LOGIN_FAILED' => [ 'message' => 'Invalid username or password.', 'type' => self::TYPE_ERROR, 'dismissible' => true ], 'LOGIN_BLOCKED' => [ 'message' => 'Too many failed attempts. Please try again later.', 'type' => self::TYPE_ERROR, 'dismissible' => false ], 'IP_BLACKLISTED' => [ 'message' => 'Access denied. Your IP address is blacklisted.', 'type' => self::TYPE_ERROR, 'dismissible' => false ] ]; /** * Get message configuration by key */ public static function get($category, $key) { $messages = constant("self::$category"); return $messages[$key] ?? null; } /** * Render message HTML */ public static function render($category, $key, $customMessage = null) { $config = self::get($category, $key); if (!$config) return ''; $message = $customMessage ?? $config['message']; $dismissible = $config['dismissible'] ? ' alert-dismissible fade show' : ''; $dismissButton = $config['dismissible'] ? '' : ''; return sprintf( '