public function generateUserPassword(User $user, $password, $generateOld = false)
    {
        $registrationDate = $user->RegDate;

        $pre = $this->encode($registrationDate);
        $pos = substr($registrationDate, 5, 1);
        $post = $this->encode($registrationDate * (substr($registrationDate, $pos, 1)));

        $finalString = $pre . $password . $post;

        return $generateOld ? md5($finalString) : sha1($finalString);
    }