init
This commit is contained in:
35
mysyde/common/classes/StdMD5PasswordCheckerStrategy.php
Normal file
35
mysyde/common/classes/StdMD5PasswordCheckerStrategy.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace DynCom\mysyde\common\classes;
|
||||
use DynCom\mysyde\common\interfaces\PasswordCheckerInterface;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Bauer
|
||||
* Date: 13.01.2015
|
||||
* Time: 13:56
|
||||
*/
|
||||
class StdMD5PasswordCheckerStrategy implements PasswordCheckerInterface {
|
||||
|
||||
/**
|
||||
* @param $storedPass
|
||||
* @param $inputPass
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid( $storedPass, $inputPass ) {
|
||||
return $this->_isValid($storedPass, $inputPass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $storedPass
|
||||
* @param $inputPass
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isValid( $storedPass, $inputPass ) {
|
||||
$stored = trim((string)$storedPass);
|
||||
$input = trim((string)$inputPass);
|
||||
return (strlen($stored) > 0 && strlen($input) > 0 && $input === md5($stored));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user