mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
26 lines
684 B
PHP
26 lines
684 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Accounts\Services;
|
|
|
|
|
|
use App\Classes\Exceptions\AccessUnauthorisedException;
|
|
use App\Classes\Modules\Accounts\DataTransferObjects\AuthenticationCredentialsObject;
|
|
class AuthenticatesUser
|
|
{
|
|
|
|
/**
|
|
* @param AuthenticationCredentialsObject $object
|
|
* @return false|string
|
|
* @throws AccessUnauthorisedException
|
|
*/
|
|
public function execute(AuthenticationCredentialsObject $object){
|
|
|
|
if (! auth()->validate(['email' => $object->getEmail(), 'password' => $object->getPassword()])) {
|
|
throw new AccessUnauthorisedException('These credentials do not match our records.');
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |