2023-12-05 14:41:25 -08:00
|
|
|
<div>
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
|
|
<h2>
|
2023-12-12 11:28:04 -08:00
|
|
|
OAuth Clients
|
2023-12-05 14:41:25 -08:00
|
|
|
</h2>
|
2023-12-05 18:36:59 -08:00
|
|
|
@if($authorizationError)
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<p><strong>Whoops!</strong> Something went wrong!</p>
|
|
|
|
<br>
|
|
|
|
{{ $authorizationError }}
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-12-05 14:41:25 -08:00
|
|
|
|
2023-12-05 15:39:35 -08:00
|
|
|
<a class="button button-small"
|
2023-12-12 11:28:04 -08:00
|
|
|
wire:click="$emit('openModal')"
|
|
|
|
onclick="$('#modal-create-client').modal('show');"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
|
|
|
Create New Client
|
|
|
|
</a>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="panel-body">
|
|
|
|
<!-- Current Clients -->
|
|
|
|
@if($clients->count() === 0)
|
|
|
|
<p class="m-b-none">
|
|
|
|
You have not created any OAuth clients.
|
|
|
|
</p>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@if($clients->count() > 0)
|
|
|
|
<table class="table table-borderless m-b-none">
|
|
|
|
<thead>
|
2023-12-05 12:52:14 -08:00
|
|
|
<tr>
|
|
|
|
<th>Client ID</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Secret</th>
|
|
|
|
<th><span class="sr-only">Edit</span></th>
|
|
|
|
<th><span class="sr-only">Delete</span></th>
|
|
|
|
</tr>
|
2023-12-05 14:41:25 -08:00
|
|
|
</thead>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<tbody>
|
2023-12-05 12:52:14 -08:00
|
|
|
@foreach($clients as $client)
|
2023-12-05 14:41:25 -08:00
|
|
|
<tr>
|
2023-12-05 12:52:14 -08:00
|
|
|
<!-- ID -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
{{ $client->id }}
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Name -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
{{ $client->name }}
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Secret -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
<code>{{ $client->secret }}</code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Edit Button -->
|
|
|
|
<td style="vertical-align: middle;">
|
2023-12-12 13:41:29 -08:00
|
|
|
<a class="action-link btn"
|
2023-12-05 15:39:35 -08:00
|
|
|
wire:click="editClient('{{ $client->id }}')"
|
2023-12-12 11:33:51 -08:00
|
|
|
onclick="$('#modal-edit-client').modal('show');"
|
2023-12-05 12:52:14 -08:00
|
|
|
>
|
|
|
|
Edit
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Delete Button -->
|
2023-12-05 14:41:25 -08:00
|
|
|
<td style="vertical-align: middle;" class="text-right">
|
|
|
|
<a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')">
|
|
|
|
<i class="fas fa-trash"></i>
|
2023-12-05 12:52:14 -08:00
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
2023-12-05 14:41:25 -08:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
@endif
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-06 14:20:30 -08:00
|
|
|
<div>
|
|
|
|
@if ($authorized_tokens->count() > 0)
|
|
|
|
<div>
|
|
|
|
<div class="panel panel-default">
|
2023-12-12 11:28:04 -08:00
|
|
|
<h2 class="panel-heading">Authorized Applications</h2>
|
2023-12-06 14:20:30 -08:00
|
|
|
|
|
|
|
<div class="panel-body">
|
|
|
|
<!-- Authorized Tokens -->
|
|
|
|
<table class="table table-borderless m-b-none">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Scopes</th>
|
|
|
|
<th><span class="sr-only">Delete</span></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
@foreach($authorized_tokens as $token)
|
|
|
|
<tr>
|
|
|
|
<!-- Client Name -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
{{ $token->client->name }}
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Scopes -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
@if(!$token->scopes)
|
|
|
|
<span class="label label-default">No Scopes</span>
|
|
|
|
@endif
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<!-- Revoke Button -->
|
|
|
|
<td style="vertical-align: middle;">
|
|
|
|
<a class="btn btn-sm btn-danger"
|
|
|
|
wire:click="deleteToken('{{ $token->id }}')"
|
|
|
|
>
|
|
|
|
<i class="fas fa-trash"></i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Create Client Modal -->
|
2023-12-05 15:39:35 -08:00
|
|
|
<div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog" wire:ignore.self>
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<h2 class="modal-title">
|
|
|
|
Create Client
|
|
|
|
</h2>
|
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="modal-body">
|
|
|
|
<!-- Form Errors -->
|
2023-12-05 15:39:35 -08:00
|
|
|
@if($errors->has('name') || $errors->has('redirect'))
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<p><strong>Whoops!</strong> Something went wrong!</p>
|
|
|
|
<br>
|
|
|
|
<ul>
|
|
|
|
@if($errors->has('name'))
|
|
|
|
<li>{{ $errors->first('name') }}</li>
|
|
|
|
@endif
|
|
|
|
@if($errors->has('redirect'))
|
|
|
|
<li>{{ $errors->first('redirect') }}</li>
|
|
|
|
@endif
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Create Client Form -->
|
|
|
|
<form class="form-horizontal" role="form">
|
|
|
|
<!-- Name -->
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-md-3 control-label" for="create-client-name">Name</label>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="col-md-7">
|
2023-12-05 15:39:35 -08:00
|
|
|
<input id="create-client-name"
|
|
|
|
type="text"
|
|
|
|
aria-label="create-client-name"
|
|
|
|
class="form-control"
|
2024-05-29 12:08:25 -07:00
|
|
|
wire:model.live="name"
|
2023-12-12 11:28:04 -08:00
|
|
|
wire:keydown.enter="createClient"
|
|
|
|
autofocus
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<span class="help-block">
|
|
|
|
Something your users will recognize and trust.
|
|
|
|
</span>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Redirect URL -->
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-md-3 control-label" for="redirect">Redirect URL</label>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="col-md-7">
|
2023-12-05 15:39:35 -08:00
|
|
|
<input type="text"
|
|
|
|
class="form-control"
|
|
|
|
aria-label="redirect"
|
|
|
|
name="redirect"
|
2024-05-29 12:08:25 -07:00
|
|
|
wire:model.live="redirect"
|
2023-12-12 11:28:04 -08:00
|
|
|
wire:keydown.enter="createClient"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<span class="help-block">
|
|
|
|
Your application's authorization callback URL.
|
|
|
|
</span>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Modal Actions -->
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
2023-12-05 15:39:35 -08:00
|
|
|
<button type="button"
|
|
|
|
class="btn btn-primary"
|
|
|
|
wire:click="createClient"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
|
|
|
Create
|
|
|
|
</button>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Edit Client Modal -->
|
2023-12-05 15:39:35 -08:00
|
|
|
<div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog" wire:ignore.self>
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<h4 class="modal-title">
|
|
|
|
Edit Client
|
|
|
|
</h4>
|
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 15:39:35 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="modal-body">
|
2023-12-05 15:39:35 -08:00
|
|
|
@if($errors->has('newName') || $errors->has('newRedirect'))
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<p><strong>Whoops!</strong> Something went wrong!</p>
|
|
|
|
<br>
|
|
|
|
<ul>
|
|
|
|
@if($errors->has('newName'))
|
|
|
|
<li>{{ $errors->first('newName') }}</li>
|
|
|
|
@endif
|
|
|
|
@if($errors->has('newRedirect'))
|
|
|
|
<li>{{ $errors->first('newRedirect') }}</li>
|
|
|
|
@endif
|
2023-12-05 18:36:59 -08:00
|
|
|
@if($authorizationError)
|
2023-12-05 18:22:20 -08:00
|
|
|
<li>{{ $authorizationError }}</li>
|
|
|
|
@endif
|
2023-12-05 15:39:35 -08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Edit Client Form -->
|
2023-12-05 15:39:35 -08:00
|
|
|
<form class="form-horizontal">
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Name -->
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-md-3 control-label" for="edit-client-name">Name</label>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="col-md-7">
|
2023-12-05 15:39:35 -08:00
|
|
|
<input
|
|
|
|
id="edit-client-name"
|
|
|
|
type="text"
|
|
|
|
aria-label="edit-client-name"
|
|
|
|
class="form-control"
|
2024-05-29 12:08:25 -07:00
|
|
|
wire:model.live="editName"
|
2023-12-12 11:33:51 -08:00
|
|
|
wire:keydown.enter="updateClient('{{ $editClientId }}')"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<span class="help-block">
|
|
|
|
Something your users will recognize and trust.
|
|
|
|
</span>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Redirect URL -->
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-md-3 control-label" for="redirect">Redirect URL</label>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<div class="col-md-7">
|
2023-12-05 15:39:35 -08:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
class="form-control"
|
|
|
|
name="redirect"
|
|
|
|
aria-label="redirect"
|
2024-05-29 12:08:25 -07:00
|
|
|
wire:model.live="editRedirect"
|
2023-12-12 11:33:51 -08:00
|
|
|
wire:keydown.enter="updateClient('{{ $editClientId }}')"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<span class="help-block">
|
|
|
|
Your application's authorization callback URL.
|
|
|
|
</span>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
<!-- Modal Actions -->
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
2023-12-05 12:52:14 -08:00
|
|
|
|
2023-12-05 18:22:20 -08:00
|
|
|
<button
|
2023-12-05 15:39:35 -08:00
|
|
|
class="btn btn-primary"
|
|
|
|
wire:click="updateClient('{{ $editClientId }}')"
|
2023-12-05 14:41:25 -08:00
|
|
|
>
|
2023-12-05 15:39:35 -08:00
|
|
|
Update Client
|
2023-12-05 14:41:25 -08:00
|
|
|
</button>
|
2023-12-05 12:52:14 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-05 14:41:25 -08:00
|
|
|
<script>
|
2023-12-05 18:22:20 -08:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2023-12-05 15:39:35 -08:00
|
|
|
window.livewire.on('openModal', () => {
|
2023-12-12 11:28:04 -08:00
|
|
|
$('#modal-create-client').modal('show').on('shown.bs.modal', function() {
|
|
|
|
$(this).find('[autofocus]').focus();
|
|
|
|
});
|
2023-12-05 15:39:35 -08:00
|
|
|
});
|
|
|
|
});
|
2023-12-05 18:22:20 -08:00
|
|
|
window.addEventListener('clientCreated', function() {
|
2023-12-05 15:39:35 -08:00
|
|
|
$('#modal-create-client').modal('hide');
|
|
|
|
});
|
2023-12-05 18:22:20 -08:00
|
|
|
window.addEventListener('editClient', function() {
|
2023-12-05 15:39:35 -08:00
|
|
|
$('#modal-edit-client').modal('show');
|
|
|
|
});
|
2023-12-05 18:22:20 -08:00
|
|
|
window.addEventListener('clientUpdated', function() {
|
|
|
|
$('#modal-edit-client').modal('hide');
|
|
|
|
});
|
|
|
|
|
2023-12-05 15:39:35 -08:00
|
|
|
|
2023-12-05 14:41:25 -08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</div>
|