Replace Auth System #3
@@ -31,14 +31,13 @@ class DiscordAuthController extends Controller
|
|||||||
|
|
||||||
$user = User::where('discord_id', $discordUser->id)->first();
|
$user = User::where('discord_id', $discordUser->id)->first();
|
||||||
|
|
||||||
if (! $user) {
|
if (!$user) {
|
||||||
// link by email if it already exists
|
// link by email if it already exists
|
||||||
$user = User::where('email', $discordUser->email)->first();
|
$user = User::where('email', $discordUser->email)->first();
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$user->update([
|
$user->update([
|
||||||
'discord_id' => $discordUser->id,
|
'discord_id' => $discordUser->id,
|
||||||
'discord_name' => $discordUser->nickname ?? $discordUser->name,
|
|
||||||
'discord_avatar' => $discordUser->avatar,
|
'discord_avatar' => $discordUser->avatar,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
@@ -47,7 +46,6 @@ class DiscordAuthController extends Controller
|
|||||||
'name' => $discordUser->name,
|
'name' => $discordUser->name,
|
||||||
'email' => $discordUser->email,
|
'email' => $discordUser->email,
|
||||||
'discord_id' => $discordUser->id,
|
'discord_id' => $discordUser->id,
|
||||||
'discord_name' => $discordUser->nickname ?? $discordUser->name,
|
|
||||||
'discord_avatar' => $discordUser->avatar,
|
'discord_avatar' => $discordUser->avatar,
|
||||||
'password' => bcrypt(Str::random(40)),
|
'password' => bcrypt(Str::random(40)),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ class AdminUserSearch extends Component
|
|||||||
$users = User::when($this->filtered !== [], fn ($query) => $query->where('id', '>=', 10000))
|
$users = User::when($this->filtered !== [], fn ($query) => $query->where('id', '>=', 10000))
|
||||||
->when($this->patreon !== [], fn ($query) => $query->where('is_patreon', 1))
|
->when($this->patreon !== [], fn ($query) => $query->where('is_patreon', 1))
|
||||||
->when($this->banned !== [], fn ($query) => $query->where('is_banned', 1))
|
->when($this->banned !== [], fn ($query) => $query->where('is_banned', 1))
|
||||||
->when($this->search !== '', fn ($query) => $query->where(function($query) {
|
->when($this->search !== '', fn ($query) => $query->where('name', 'like', '%'.$this->search.'%'))
|
||||||
$query->where('name', 'like', '%'.$this->search.'%')
|
|
||||||
->orWhere('discord_name', 'like', '%'.$this->search.'%');
|
|
||||||
}))
|
|
||||||
->paginate(20);
|
->paginate(20);
|
||||||
|
|
||||||
return view('livewire.admin-user-search', [
|
return view('livewire.admin-user-search', [
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class User extends Authenticatable
|
|||||||
'is_banned',
|
'is_banned',
|
||||||
// Discord
|
// Discord
|
||||||
'discord_id',
|
'discord_id',
|
||||||
'discord_name',
|
|
||||||
'discord_avatar',
|
'discord_avatar',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -60,26 +59,9 @@ class User extends Authenticatable
|
|||||||
'tag_blacklist' => 'array',
|
'tag_blacklist' => 'array',
|
||||||
// Discord
|
// Discord
|
||||||
'discord_id' => 'integer',
|
'discord_id' => 'integer',
|
||||||
'discord_name' => 'string',
|
|
||||||
'discord_avatar' => 'string',
|
'discord_avatar' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the user name
|
|
||||||
*/
|
|
||||||
public function getUserName(): string
|
|
||||||
{
|
|
||||||
if (!$this->discord_name) {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->discord_name == $this->name)
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "{$this->name} ({$this->discord_name})";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has Many Playlists.
|
* Has Many Playlists.
|
||||||
|
|||||||
@@ -122,12 +122,11 @@ class CommentService
|
|||||||
$url = '/hentai/' . $episode->slug . '#comment-' . $reply->id;
|
$url = '/hentai/' . $episode->slug . '#comment-' . $reply->id;
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$username = $user->discord_name ?? $user->name;
|
|
||||||
|
|
||||||
$parentCommentUser = User::where('id', $comment->commenter_id)->firstOrFail();
|
$parentCommentUser = User::where('id', $comment->commenter_id)->firstOrFail();
|
||||||
$parentCommentUser->notify(
|
$parentCommentUser->notify(
|
||||||
new CommentNotification(
|
new CommentNotification(
|
||||||
"{$username} replied to your comment.",
|
"{$user->name} replied to your comment.",
|
||||||
Str::limit($reply->comment, 50),
|
Str::limit($reply->comment, 50),
|
||||||
$url
|
$url
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ return new class extends Migration
|
|||||||
$table->dropColumn('public_flags');
|
$table->dropColumn('public_flags');
|
||||||
$table->dropColumn('verified');
|
$table->dropColumn('verified');
|
||||||
$table->dropColumn('mfa_enabled');
|
$table->dropColumn('mfa_enabled');
|
||||||
|
$table->dropColumn('global_name');
|
||||||
|
$table->dropColumn('locale');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Change & Add Columns
|
// Change & Add Columns
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
// Rename
|
// Rename
|
||||||
$table->renameColumn('username', 'name');
|
$table->renameColumn('username', 'name');
|
||||||
$table->renameColumn('global_name', 'discord_name');
|
|
||||||
$table->renameColumn('avatar', 'discord_avatar');
|
$table->renameColumn('avatar', 'discord_avatar');
|
||||||
|
$table->string('avatar')->nullable()->after('email');
|
||||||
|
|
||||||
// Re-Add Email verification
|
// Re-Add Email verification
|
||||||
$table->timestamp('email_verified_at')->nullable()->after('email');
|
$table->timestamp('email_verified_at')->nullable()->after('email');
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
@if (Auth::user()->discord_avatar)
|
@if (Auth::user()->discord_avatar)
|
||||||
<img class="h-8 w-8 rounded-full object-cover mr-2"
|
<img class="h-8 w-8 rounded-full object-cover mr-2"
|
||||||
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
|
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
|
||||||
alt="{{ Auth::user()->getUserName() }}" />
|
alt="{{ Auth::user()->name }}" />
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
|
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
|
|
||||||
@auth
|
@auth
|
||||||
<div style="display: flex; flex-direction: row; align-items: flex-start;">
|
<div style="display: flex; flex-direction: row; align-items: flex-start;">
|
||||||
{{ Auth::user()->getUserName() }}
|
{{ Auth::user()->name }}
|
||||||
@if ($notAvailable)
|
@if ($notAvailable)
|
||||||
<i class="fa-solid fa-bell text-rose-600"></i>
|
<i class="fa-solid fa-bell text-rose-600"></i>
|
||||||
@endif
|
@endif
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
@if (Auth::user()->discord_avatar)
|
@if (Auth::user()->discord_avatar)
|
||||||
<img class="h-8 w-8 rounded-full object-cover mr-2"
|
<img class="h-8 w-8 rounded-full object-cover mr-2"
|
||||||
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
|
src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ Auth::user()->discord_id }}/{{ Auth::user()->discord_avatar }}.webp"
|
||||||
alt="{{ Auth::user()->getUserName() }}" />
|
alt="{{ Auth::user()->name }}" />
|
||||||
@else
|
@else
|
||||||
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
|
<img class="h-8 w-8 rounded-full object-cover mr-2" src="/images/default-avatar.webp"
|
||||||
alt="Guest" />
|
alt="Guest" />
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
{{ $user->id }}
|
{{ $user->id }}
|
||||||
</th>
|
</th>
|
||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
{{ $user->discord_name ?? $user->name }}
|
{{ $user->name }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
{{ $user->is_patreon ? 'Yes' : 'No' }}
|
{{ $user->is_patreon ? 'Yes' : 'No' }}
|
||||||
|
|||||||
@@ -7,17 +7,17 @@
|
|||||||
@php $user = cache()->rememberForever('commentUser'.$comment->commenter_id, fn () => \App\Models\User::where('id', $comment->commenter_id)->first()); @endphp
|
@php $user = cache()->rememberForever('commentUser'.$comment->commenter_id, fn () => \App\Models\User::where('id', $comment->commenter_id)->first()); @endphp
|
||||||
<div>
|
<div>
|
||||||
@if($user->discord_avatar)
|
@if($user->discord_avatar)
|
||||||
<img class="w-16 h-16 rounded-full m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $user->discord_id }}/{{ $user->discord_avatar }}.webp" alt="{{ $user->discord_name ?? $user->name }} Avatar">
|
<img class="w-16 h-16 rounded-full m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $user->discord_id }}/{{ $user->discord_avatar }}.webp" alt="{{ $user->name }} Avatar">
|
||||||
@else
|
@else
|
||||||
<img class="w-16 h-16 rounded-full m-2" src="/images/default-avatar.webp" alt="{{ $user->discord_name ?? $user->name }} Avatar">
|
<img class="w-16 h-16 rounded-full m-2" src="/images/default-avatar.webp" alt="{{ $user->name }} Avatar">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="text-gray-800 dark:text-gray-200">
|
<div class="text-gray-800 dark:text-gray-200">
|
||||||
<div>
|
<div>
|
||||||
@if($user->is_patreon)
|
@if($user->is_patreon)
|
||||||
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->discord_name ?? $user->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
|
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
|
||||||
@else
|
@else
|
||||||
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->discord_name ?? $user->name }} <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
|
<h5 class="text-gray-800 dark:text-gray-400">{{ $user->name }} <small class="text-muted">- {{ \Carbon\Carbon::parse($comment->created_at)->diffForHumans() }}</small></h5>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>
|
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>
|
||||||
|
|||||||
@@ -23,14 +23,6 @@
|
|||||||
<x-input-error class="mt-2" :messages="$errors->get('name')" />
|
<x-input-error class="mt-2" :messages="$errors->get('name')" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (Auth::user()->discord_name)
|
|
||||||
<div>
|
|
||||||
<x-input-label for="discord_name" :value="__('Discord Name')" />
|
|
||||||
<x-text-input id="discord_name" name="discord_name" type="text" class="mt-1 block w-full" :value="old('discord_name', $user->discord_name)" required autocomplete="discord_name" disabled />
|
|
||||||
<x-input-error class="mt-2" :messages="$errors->get('discord_name')" />
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<x-input-label for="email" :value="__('Email')" />
|
<x-input-label for="email" :value="__('Email')" />
|
||||||
<x-text-input id="email" name="email" type="email" class="mt-1 block w-full" :value="old('email', $user->email)" required autocomplete="email" disabled />
|
<x-text-input id="email" name="email" type="email" class="mt-1 block w-full" :value="old('email', $user->email)" required autocomplete="email" disabled />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<p class="text-neutral-800 dark:text-neutral-300">
|
<p class="text-neutral-800 dark:text-neutral-300">
|
||||||
{{ $playlist->user->discord_name ?? $playlist->user->name }} • {{ $currentIndex + 1 }}/{{ $episodeCount }} Episodes
|
{{ $playlist->user->name }} • {{ $currentIndex + 1 }}/{{ $episodeCount }} Episodes
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@endif
|
@endif
|
||||||
<div class="flex flex-col py-5 pl-24">
|
<div class="flex flex-col py-5 pl-24">
|
||||||
<strong class="text-slate-900 text-xl font-bold dark:text-slate-200">
|
<strong class="text-slate-900 text-xl font-bold dark:text-slate-200">
|
||||||
{{ $user->discord_name ?? $user->name }}
|
{{ $user->name }}
|
||||||
@if ($user->is_patreon)
|
@if ($user->is_patreon)
|
||||||
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i
|
<a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i
|
||||||
class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a>
|
class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a>
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
|
|
||||||
<div class="contents">
|
<div class="contents">
|
||||||
@if($comment->commenter->discord_avatar)
|
@if($comment->commenter->discord_avatar)
|
||||||
<img class="w-12 h-12 rounded-lg m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $comment->commenter->discord_id }}/{{ $comment->commenter->discord_avatar }}.webp" alt="{{ $comment->commenter->discord_name ?? $comment->commenter->name }} Avatar">
|
<img class="w-12 h-12 rounded-lg m-2" src="https://external-content.duckduckgo.com/iu/?u=https://cdn.discordapp.com/avatars/{{ $comment->commenter->discord_id }}/{{ $comment->commenter->discord_avatar }}.webp" alt="{{ $comment->commenter->name }} Avatar">
|
||||||
@else
|
@else
|
||||||
<img class="w-12 h-12 rounded-lg m-2" src="/images/default-avatar.webp" alt="{{ $comment->commenter->discord_name ?? $comment->commenter->name }} Avatar">
|
<img class="w-12 h-12 rounded-lg m-2" src="/images/default-avatar.webp" alt="{{ $comment->commenter->name }} Avatar">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-gray-800 dark:text-gray-200">
|
<div class="text-gray-800 dark:text-gray-200">
|
||||||
<div>
|
<div>
|
||||||
@if($comment->commenter->is_patreon)
|
@if($comment->commenter->is_patreon)
|
||||||
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->discord_name ?? $comment->commenter->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
|
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->name }} <a data-te-toggle="tooltip" title="Badge of appreciation for the horny people supporting us! :3"><i class="fa-solid fa-hand-holding-heart text-rose-600 animate-pulse"></i></a> <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
|
||||||
@else
|
@else
|
||||||
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->discord_name ?? $comment->commenter->name }} <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
|
<h5 class="text-gray-800 dark:text-gray-400">{{ $comment->commenter->name }} <small class="text-muted">- {{ $comment->created_at->diffForHumans() }}</small></h5>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>
|
<div style="white-space: pre-wrap;">{!! $markdown->line($comment->comment) !!}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user