mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
|
|
|
use App\Classes\Modules\Accounts\DataTransferObjects\AuthenticationCredentialsObject;
|
|
use App\Classes\Modules\Accounts\Services\AuthenticatesUser;
|
|
use App\Classes\Modules\Accounts\Services\AuthenticationRedirect;
|
|
use App\Classes\Modules\Accounts\Services\FetchesUser;
|
|
use App\Classes\Modules\Accounts\Standards\Rules\CanAuthenticateUser;
|
|
use App\Classes\General\Abstracts\AbstractControllersLogic;
|
|
use App\Classes\ValueObjects\Constants\Notifications;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CheckEmailLogic extends AbstractControllersLogic
|
|
{
|
|
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'User found',
|
|
'message' => 'Account Already Exists'
|
|
];
|
|
}
|
|
|
|
/** @var FetchesUser */
|
|
private $fetchesUser;
|
|
|
|
|
|
/**
|
|
* CheckEmailLogic constructor.
|
|
* @param FetchesUser $fetchesUser
|
|
*/
|
|
public function __construct(FetchesUser $fetchesUser)
|
|
{
|
|
$this->fetchesUser = $fetchesUser;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws ErrorException
|
|
*/
|
|
protected function logic(Request $request): JsonResponse {
|
|
|
|
try {
|
|
|
|
$this->fetchesUser->execute(['email' => $request->input('email')]);
|
|
|
|
return $this->response();
|
|
|
|
} catch (\Exception $exception){
|
|
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
|
}
|
|
|
|
}
|
|
|
|
} |