JakyeRU / Larascord

Larascord is a package that allows you to authenticate users in your Laravel application using Discord.
https://larascord.jakye.me
MIT License
67 stars 14 forks source link

[BUG] User will be created in database despite it the user has not the certain roles #107

Closed TFWIsaac closed 1 year ago

TFWIsaac commented 1 year ago

I have found the following bug:

If you have enabled that a user must be member of a certain guild with certain roles then this bug occurs:

If the user is member of the guild and has not the certain roles as defined, the user will despite it created in the user table and that is strange.

Please fix this behaviour, its really strange for me, that users occurs in my user table without the certain roles.

JakyeRU commented 1 year ago

The issue should now be fixed in v5.0.6. Thank you for reporting it!

TFWIsaac commented 1 year ago

i am sure, this broke something... After updating to new version i got this error:

Jakyeru\Larascord\Services\DiscordService::hasRoleInGuild(): Argument #1 ($user) must be of type App\Models\User, Jakyeru\Larascord\Types\User given

TFWIsaac commented 1 year ago

I think this come from: https://larascord.jakye.me/interacts_with_discord#getguildmember

This is the complete message:

Jakyeru\Larascord\Services\DiscordService::hasRoleInGuild(): Argument #1 ($user) must be of type App\Models\User, Jakyeru\Larascord\Types\User given, called in C:\laragon\www\ttt-ng\vendor\jakyeru\larascord\src\Http\Controllers\DiscordController.php on line 87

EDIT: I get this error after the authorize by discord

JakyeRU commented 1 year ago

I deleted the release. I'll take a look at it as soon as possible.

JakyeRU commented 1 year ago

The new patch should work this time. I've used database transactions to make sure everything goes smoothly during the login process.