Skip to content

Commit

Permalink
fix: fixing dynamic user class (#526)
Browse files Browse the repository at this point in the history
* fix: fixing dynamic user class

* Fix styling

---------

Co-authored-by: binaryk <[email protected]>
  • Loading branch information
binaryk and binaryk authored Feb 3, 2023
1 parent 800a7a4 commit 1d7370b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Http/Controllers/Auth/VerifyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
namespace Binaryk\LaravelRestify\Http\Controllers\Auth;

use Binaryk\LaravelRestify\Contracts\Sanctumable;
use Binaryk\LaravelRestify\Tests\Fixtures\User\User;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\Events\Verified;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Routing\Controller;

class VerifyController extends Controller
{
public function __invoke(int $id, string $hash)
{
$user = User::query()->findOrFail($id);
/**
* @var Authenticatable $user
*/
$user = config('restify.auth.user_model')::query()->findOrFail($id);

if ($user instanceof Sanctumable && ! hash_equals((string) $hash, sha1($user->getEmailForVerification()))) {
throw new AuthorizationException('Invalid hash');
Expand Down

0 comments on commit 1d7370b

Please sign in to comment.