Skip to content

Commit

Permalink
Merge pull request #123 from AiAe/dev-aiae
Browse files Browse the repository at this point in the history
Allow re-linking Discord
  • Loading branch information
AiAe authored May 28, 2024
2 parents ae90bce + b3a5b21 commit 5661d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 5661d28

Please sign in to comment.