PHP 8.2.30
Preview: PlaintextPasswordEncoder.php Size: 1.51 KB
/opt/cloudlinux/alt-php53/root/usr/share/pear/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Core\Encoder;

use Symfony\Component\Security\Core\Exception\BadCredentialsException;

/**
 * PlaintextPasswordEncoder does not do any encoding.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class PlaintextPasswordEncoder extends BasePasswordEncoder
{
    private $ignorePasswordCase;

    /**
     * Constructor.
     *
     * @param Boolean $ignorePasswordCase Compare password case-insensitive
     */
    public function __construct($ignorePasswordCase = false)
    {
        $this->ignorePasswordCase = $ignorePasswordCase;
    }

    /**
     * {@inheritdoc}
     */
    public function encodePassword($raw, $salt)
    {
        if ($this->isPasswordTooLong($raw)) {
            throw new BadCredentialsException('Invalid password.');
        }

        return $this->mergePasswordAndSalt($raw, $salt);
    }

    /**
     * {@inheritdoc}
     */
    public function isPasswordValid($encoded, $raw, $salt)
    {
        if ($this->isPasswordTooLong($raw)) {
            return false;
        }

        $pass2 = $this->mergePasswordAndSalt($raw, $salt);

        if (!$this->ignorePasswordCase) {
            return $this->comparePasswords($encoded, $pass2);
        }

        return $this->comparePasswords(strtolower($encoded), strtolower($pass2));
    }
}

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
2.73 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
2.47 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
1.93 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
881 B lrw-r--r-- 2019-12-18 11:20:42
Edit Download
2.13 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
1.02 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
3.37 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download
1.51 KB lrw-r--r-- 2019-12-18 11:20:42
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).