Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Change Password Bundle Laravel Package

acseo/change-password-bundle

Symfony bundle for managing user password history with FOSUserBundle: stores previous hashed passwords, forces change when passwords are older than 30 days, and optionally blocks reusing old passwords via a validation constraint.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Aligns with FOSUserBundle (a widely adopted Laravel/PHP user management solution), reducing integration friction.
    • Modular design (Symfony bundle) allows plug-and-play adoption in existing Symfony/Laravel ecosystems.
    • Addresses compliance (password history, rotation policies) and security (prevent password reuse) without reinventing core auth logic.
    • MIT license enables low-risk adoption for open-source projects.
  • Cons:

    • Tight coupling to FOSUserBundle may limit flexibility if migrating away from it.
    • Lack of Laravel-native support (Symfony bundle) requires adaptation layer (e.g., Symfony Bridge or custom wrapper).
    • Minimal adoption (4 stars, 0 dependents) suggests unproven scalability or niche use case.

Integration Feasibility

  • Symfony/Laravel Bridge:

    • Requires Symfony components (e.g., symfony/bundle, symfony/dependency-injection) if not already in stack.
    • Laravel-specific challenges:
      • Doctrine ORM integration may need adapters (e.g., Laravel Doctrine bridge).
      • Event listeners (e.g., fos_user.change_password) must be mapped to Laravel’s auth events.
    • FOSUserBundle dependency: If not already used, adds significant overhead (auth system rewrite).
  • Database Schema:

    • password_history table is straightforward but requires migration tooling (e.g., Laravel Migrations or Doctrine Schema updates).
    • Indexing on user_id and created_at recommended for performance.

Technical Risk

  • High:

    • Bundle maturity: No dependents, untested in production (per README "maturity" label).
    • Symfony vs. Laravel divergence: Risk of hidden dependencies (e.g., Symfony’s EventDispatcher).
    • Password hashing conflicts: Bundle assumes legacy FOSUserBundle hashing (e.g., sha512). Modern Laravel uses bcrypt/argon2hashing strategy must align.
    • Route conflicts: Hardcoded fos_user_change_password route may clash with Laravel’s native /password routes.
  • Mitigation:

    • Proof-of-concept (PoC): Test in a staging environment with a subset of users.
    • Wrapper layer: Abstract Symfony-specific logic behind a Laravel service provider.
    • Customization: Override bundle behavior via configuration (e.g., password rotation interval).

Key Questions

  1. Auth Stack Compatibility:

    • Does the project use FOSUserBundle? If not, what’s the cost to migrate?
    • Are password hashing algorithms compatible (e.g., bcrypt vs. sha512)?
  2. Performance:

    • How will password_history table scale with millions of users? (Query optimization needed?)
    • What’s the impact on login performance (hash comparison overhead)?
  3. Security:

    • Does the bundle sanitize inputs to prevent SQL injection in password_history?
    • How are password hashes stored? (Avoid plaintext or weak hashing.)
  4. Maintenance:

    • Who supports the bundle? (No maintainer listed in README.)
    • Are there plans for Laravel-native ports or Symfony 6+ compatibility?
  5. Alternatives:

    • Could Laravel’s built-in passwords package + custom middleware achieve the same goals with less risk?
    • Are there enterprise-grade alternatives (e.g., Auth0, Okta) for password policies?

Integration Approach

Stack Fit

  • Best Fit:

    • Symfony applications using FOSUserBundle.
    • Laravel projects already integrated with Symfony components (e.g., via laravel/symfony-bridge).
  • Poor Fit:

    • Vanilla Laravel without Symfony dependencies (high adaptation cost).
    • Projects requiring fine-grained password policy customization (bundle is rigid).

Migration Path

  1. Assessment Phase:

    • Audit current auth stack (identify FOSUserBundle usage, hashing methods).
    • Benchmark login performance with/without password history.
  2. Dependency Setup:

    • Install via Composer:
      composer require acseo/change-password-bundle:dev-master
      
    • For Laravel: Use Symfony Bridge or create a custom service provider to load the bundle.
  3. Configuration:

    • Map User entity to extend FOS\UserBundle\Model\User (or create a compatibility layer).
    • Configure Doctrine in config/packages/doctrine.yaml (Laravel) or app/config/config.yml (Symfony):
      doctrine:
          orm:
              resolve_target_entities:
                  FOS\UserBundle\Model\User: App\Entity\User
      
  4. Database Migration:

    • Generate and run migrations for password_history:
      php artisan doctrine:migrations:diff  # If using Laravel Doctrine bridge
      php artisan migrate
      
    • Add indexes for user_id and created_at:
      // Example migration
      Schema::create('password_history', function (Blueprint $table) {
          $table->id();
          $table->foreignId('user_id')->constrained()->onDelete('cascade');
          $table->string('password_hash');
          $table->timestamp('created_at')->useCurrent();
          $table->index(['user_id', 'created_at']);
      });
      
  5. Routing & Events:

    • Override fos_user_change_password route in Laravel’s routes/web.php:
      Route::post('/change-password', [ChangePasswordController::class, 'changePassword'])->name('fos_user_change_password');
      
    • Listen to fos_user.change_password events (use Symfony’s EventDispatcher or Laravel’s Events facade).
  6. Testing:

    • Validate password history logging.
    • Test 30-day rotation enforcement and password reuse blocking.

Compatibility

  • Symfony:

    • Native support if using FOSUserBundle.
    • May require Symfony 5.4+ (check bundle compatibility).
  • Laravel:

    • Partial support: Needs adapters for:
      • Doctrine ORM (use laravel-doctrine/orm).
      • Symfony’s EventDispatcher (use symfony/event-dispatcher package).
    • Route conflicts: Rename or proxy fos_user_change_password to Laravel’s routing system.
  • Password Hashing:

    • Ensure bundle’s PasswordHistory entity stores hashes in the same format as Laravel’s users table (e.g., bcrypt).

Sequencing

  1. Phase 1: Set up bundle in a non-production environment.
  2. Phase 2: Implement password history logging (low-risk).
  3. Phase 3: Enable 30-day rotation (test user experience).
  4. Phase 4: Add password reuse blocking (validate security impact).
  5. Phase 5: Monitor performance and login failures.

Operational Impact

Maintenance

  • Pros:

    • MIT license allows modifications.
    • Doctrine-based: Schema changes are version-controlled.
  • Cons:

    • No official Laravel support: Bug fixes require custom patches.
    • Dependency on FOSUserBundle: Future migrations may break compatibility.
    • Password history cleanup: Requires cron jobs or Doctrine queries to purge old entries.

Support

  • Challenges:

    • No maintainer: Issues may go unaddressed (check GitHub issues for red flags).
    • Symfony-centric docs: Laravel-specific troubleshooting requires community input.
    • Debugging: Complex event flows (e.g., password change triggers) may need Xdebug or logs.
  • Mitigation:

    • Fork the repo for critical fixes.
    • Document customizations for future teams.

Scaling

  • Database:

    • password_history table could grow large (e.g., 1M users × 5 passwords = 5M rows).
    • Optimizations:
      • Archive old entries (e.g., keep last 5 passwords).
      • Add partitioning by user_id or created_at.
    • Read replicas: Offload history queries to replicas if login performance degrades.
  • Performance:

    • Password change: Hash comparison adds ~50ms (benchmark in staging).
    • Login: Check password_history on auth (add indexes to mitigate).

Failure Modes

Failure Scenario Impact Mitigation
Bundle conflicts with Laravel auth Broken password changes Isolate bundle in a micro-service
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui