#1733 Patron yarısı - expense showing data (rapor gösterilmesi)

This commit is contained in:
Diatrex 2020-06-29 18:21:09 +03:00
parent d9c3d34118
commit dc124f7a00

View File

@ -4,28 +4,31 @@ use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterface;
use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Visiosoft\ProfileModule\Profile\Events\SendEmptyPassword;
use Visiosoft\ProfileModule\Profile\SignIn\SignInFormBuilder;
class ValidateCredentials
{
private $extensions;
private $repository;
private $dispatcher;
private $config;
public function __construct(
ExtensionCollection $extensions,
UserRepositoryInterface $userRepository,
Dispatcher $dispatcher
Dispatcher $dispatcher,
Repository $config
)
{
$this->extensions = $extensions;
$this->repository = $userRepository;
$this->dispatcher = $dispatcher;
$this->config = $config;
}
public function authenticate(array $credentials)
@ -37,20 +40,22 @@ class ValidateCredentials
/* @var AuthenticatorExtensionInterface $authenticator */
foreach ($authenticators as $authenticator) {
if ($authenticator->slug == "default_authenticator") {
if (!isset($credentials['password']) && !isset($credentials['email'])) {
$method = $this->config->get('anomaly.module.users::config.login');
if (!isset($credentials['password']) && !isset($credentials[$method])) {
$response = null;
}
//Is email or phone number
if (!filter_var($credentials['email'], FILTER_VALIDATE_EMAIL)) {
$possiblePhone = $credentials['email'];
if (substr($credentials['email'], 0, 1) == 0) {
$possiblePhone = substr($credentials['email'], 1);
//Is email/username or phone number
if (!filter_var($credentials[$method], FILTER_VALIDATE_EMAIL)) {
$possiblePhone = $credentials[$method];
if (substr($credentials[$method], 0, 1) == 0) {
$possiblePhone = substr($credentials[$method], 1);
}
if ($user = $this->repository
->newQuery()
->where('gsm_phone', 'LIKE', "%$possiblePhone")->first()) {
$credentials['email'] = $user->email;
$credentials[$method] = $user->email;
}
}
$response = $this->repository->findByCredentials($credentials);