Last Updated: February 25, 2016
·
409
· halilim

Migrate Wordpress user passwords to Sentry

Add this to somewhere in your code (e.g. app/start/global.php in a Laravel 4 app) and you are all set (note that Sentry must be configured to use the native hasher, which is the default):

Cartalyst\Sentry\Hashing\NativeHasher::addFallback(
    "wp",
    function ($password, $hash) {
        return MikeMcLin\WpPassword\WpPassword::check($password, $hash);
    }
);

This will allow you to:

  1. Use your old Wordpress passwords in your new Sentry app without resetting them,
  2. Gradually upgrade passwords.