diff --git a/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php new file mode 100644 index 00000000..f3353622 --- /dev/null +++ b/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php @@ -0,0 +1,46 @@ + 'Authentication', + 'message' => 'You have successfully logged in to your account' + ]; + } + + /** @var AuthenticationProcessor */ + private $authenticationProcessor; + + + /** + * AuthenticateUserLogic constructor. + * @param AuthenticationProcessor $authenticationProcessor + */ + public function __construct(AuthenticationProcessor $authenticationProcessor) + { + $this->authenticationProcessor = $authenticationProcessor; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\AccessUnauthorisedException + * @throws \App\Classes\Exceptions\InternalServerErrorException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function logic(Request $request): JsonResponse { + + return $this->response($this->authenticationProcessor->execute($request)); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Accounts/UserAuthenticationController.php b/app/Http/Controllers/Accounts/UserAuthenticationController.php new file mode 100644 index 00000000..fdf4442d --- /dev/null +++ b/app/Http/Controllers/Accounts/UserAuthenticationController.php @@ -0,0 +1,21 @@ +execute($request); + } + +} diff --git a/routes/account.php b/routes/account.php index 6f92bf11..4fca7c43 100644 --- a/routes/account.php +++ b/routes/account.php @@ -10,6 +10,7 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account Route::group(['prefix' => 'authentication', 'as' => 'authentication.'], function () { Route::group(['prefix' => 'login', 'as' => 'authenticate.'], function () { + Route::post('/attempt', 'UserAuthenticationController@authenticate')->name('attempt'); Route::post('/check_email', 'CheckEmailController@check')->name('email.check'); }); });