app\components\Helper::checkPassword PHP Method

checkPassword() private static method

Password check Based upon http://stackoverflow.com/a/10753064.
private static checkPassword ( $pwd )
$pwd
    private static function checkPassword($pwd)
    {
        $errors = [];
        if (strlen($pwd) < 8) {
            $errors[] = 'Password too short!';
        }
        if (!preg_match('#[0-9]+#', $pwd)) {
            $errors[] = 'Password must include at least one number!';
        }
        if (!preg_match('#[a-zA-Z]+#', $pwd)) {
            $errors[] = 'Password must include at least one letter!';
        }
        if (count($errors) > 0) {
            $msg = implode('<br/>', $errors);
            \Yii::$app->session->addFlash('danger', "Application admin password from environment setting is not strong enough.<br/><i>{$msg}</i>");
        }
    }