Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow re-linking Discord #123

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Http/Controllers/Web/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function redirectToProvider(Request $request, $driver)
return $this->sendFailedResponse("{$driver} is not currently supported");
}

if (Auth::user() && !empty(Auth::user()->discord_user_id)) {
// Allow re-linking Discord
if (Auth::user() && $driver !== "discord") {
return $this->sendFailedResponse(__("You are already logged in!"));
}

Expand Down
5 changes: 4 additions & 1 deletion resources/views/web/user/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
<div class="col-lg-6">
<label class="form-label">{{ __('Linked Discord ID') }}</label>
<div class="input-group">

{{ Form::text('', $loggedUser['discord_user_id'], ['class' => 'form-control', 'readonly' => 'readonly']) }}
@if($loggedUser['discord_user_id'] == null)
<div class="input-group-append">
<a href="{{ route('web.auth.oauth', ['driver' => 'discord', 'redirect' => current_route()]) }}"
class="btn btn-discord"
style="border-bottom-left-radius: 0; border-top-left-radius: 0;">{{ __('Connect Discord') }}</a>
</div>
@else
<div class="input-group-append">
<a href="{{ route('web.auth.oauth', ['driver' => 'discord', 'redirect' => current_route()]) }}" class="btn btn-discord">Re-link Discord</a>
</div>
@endif
</div>
<small>{{ __('If you have linked the wrong Discord account, please contact tournament organizer or site admins!') }}</small>
Expand Down
Loading