mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-18 18:36:07 +08:00
API Tokens: Updated interfaces to return to correct location
Since management of API tokens can be accessed via two routes, this adds tracking and handling to reutrn the user to the correct place.
This commit is contained in:
@ -82,6 +82,6 @@
|
||||
@endif
|
||||
|
||||
@if(userCan('access-api'))
|
||||
@include('users.api-tokens.parts.list', ['user' => user()])
|
||||
@include('users.api-tokens.parts.list', ['user' => user(), 'context' => 'my-account'])
|
||||
@endif
|
||||
@stop
|
||||
|
@ -7,8 +7,8 @@
|
||||
<main class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ trans('settings.user_api_token_create') }}</h1>
|
||||
|
||||
<form action="{{ $user->getEditUrl('/create-api-token') }}" method="post">
|
||||
{!! csrf_field() !!}
|
||||
<form action="{{ url('/api-tokens/' . $user->id . '/create') }}" method="post">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="setting-list">
|
||||
@include('users.api-tokens.parts.form')
|
||||
@ -21,7 +21,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ $user->getEditUrl('#api_tokens') }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<a href="{{ $back }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<button class="button" type="submit">{{ trans('common.save') }}</button>
|
||||
</div>
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
<div class="grid half">
|
||||
<p class="text-neg"><strong>{{ trans('settings.user_api_token_delete_confirm') }}</strong></p>
|
||||
<div>
|
||||
<form action="{{ $user->getEditUrl('/api-tokens/' . $token->id) }}" method="POST" class="text-right">
|
||||
{!! csrf_field() !!}
|
||||
{!! method_field('delete') !!}
|
||||
<form action="{{ $token->getUrl() }}" method="POST" class="text-right">
|
||||
{{ csrf_field() }}
|
||||
{{ method_field('delete') }}
|
||||
|
||||
<a href="{{ $user->getEditUrl('/api-tokens/' . $token->id) }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<a href="{{ $token->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<button type="submit" class="button">{{ trans('common.confirm') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -7,9 +7,9 @@
|
||||
<main class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ trans('settings.user_api_token') }}</h1>
|
||||
|
||||
<form action="{{ $user->getEditUrl('/api-tokens/' . $token->id) }}" method="post">
|
||||
{!! method_field('put') !!}
|
||||
{!! csrf_field() !!}
|
||||
<form action="{{ $token->getUrl() }}" method="post">
|
||||
{{ method_field('put') }}
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="setting-list">
|
||||
|
||||
@ -52,8 +52,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ $user->getEditUrl('#api_tokens') }}" class="button outline">{{ trans('common.back') }}</a>
|
||||
<a href="{{ $user->getEditUrl('/api-tokens/' . $token->id . '/delete') }}" class="button outline">{{ trans('settings.user_api_token_delete') }}</a>
|
||||
<a href="{{ $back }}" class="button outline">{{ trans('common.back') }}</a>
|
||||
<a href="{{ $token->getUrl('/delete') }}" class="button outline">{{ trans('settings.user_api_token_delete') }}</a>
|
||||
<button class="button" type="submit">{{ trans('common.save') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="text-right pt-xs">
|
||||
@if(userCan('access-api'))
|
||||
<a href="{{ url('/api/docs') }}" class="button outline">{{ trans('settings.users_api_tokens_docs') }}</a>
|
||||
<a href="{{ $user->getEditUrl('/create-api-token') }}" class="button outline">{{ trans('settings.users_api_tokens_create') }}</a>
|
||||
<a href="{{ url('/api-tokens/' . $user->id . '/create?context=' . $context) }}" class="button outline">{{ trans('settings.users_api_tokens_create') }}</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@ -14,7 +14,7 @@
|
||||
@foreach($user->apiTokens as $token)
|
||||
<div class="item-list-row flex-container-row items-center wrap py-xs gap-x-m">
|
||||
<div class="flex px-m py-xs min-width-m">
|
||||
<a href="{{ $user->getEditUrl('/api-tokens/' . $token->id) }}">{{ $token->name }}</a> <br>
|
||||
<a href="{{ $token->getUrl("?context={$context}") }}">{{ $token->name }}</a> <br>
|
||||
<span class="small text-muted italic">{{ $token->token_id }}</span>
|
||||
</div>
|
||||
<div class="flex flex-container-row items-center min-width-m">
|
||||
@ -23,7 +23,7 @@
|
||||
{{ $token->expires_at->format('Y-m-d') ?? '' }}
|
||||
</div>
|
||||
<div class="flex px-m py-xs text-right">
|
||||
<a class="button outline small" href="{{ $user->getEditUrl('/api-tokens/' . $token->id) }}">{{ trans('common.edit') }}</a>
|
||||
<a class="button outline small" href="{{ $token->getUrl("?context={$context}") }}">{{ trans('common.edit') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -100,7 +100,7 @@
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@include('users.api-tokens.parts.list', ['user' => $user])
|
||||
@include('users.api-tokens.parts.list', ['user' => $user, 'context' => 'settings'])
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
Reference in New Issue
Block a user