Looking to hire Laravel developers? Try LaraJobs

laravel-password-updater maintained by tmd

Description
Handles password verification and re-hashing passwords that may be hashed by outdated methods.
Author
Last update
2016/10/09 18:01 (dev-master)
License
Links
Downloads
67

Comments
comments powered by Disqus

laravel-password-updater

Handles password verification and re-hashing passwords that may be hashed by outdated methods.

Setup

composer require tmd/laravel-password-updater

Usage

(Overly simplified example.)

<?php

use Tmd\LaravelPasswordUpdater\PasswordHasher;

public function login(PasswordHasher $passwordHasher)
{
    /** @var User $user */
    $user = User::where('username', $credentials['username'])->first();

    if (!$user) {
        return ['username' => ['There is no account with that username.']];
    }

    if (!$passwordHasher->verify($credentials['password'], $user, 'password')) {
        return ['password' => ['That password is not correct.']];
    }

    // Password is correct.
}