fix: ensure invitation feature is disabled when registrations are not
Signed-off-by: Miguel Nogueira <me@nogueira.codes>
This commit is contained in:
@@ -14,16 +14,30 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
@if(\App\Facades\Options::getOption('enable_registrations'))
|
||||
<x-alert alert-type="danger" title="{{ __('Invitation system disabled') }}" icon="fas fa-ban">
|
||||
<p>{!! __('The invitation system is currently disabled because sign ups are open to everyone. If you\'d like to change this, head over to App Settings > <a href=":globalSettingsLink">Global Settings</a> and disable registrations.', ['globalSettingsLink' => route('showSettings')]) !!}</p>
|
||||
</x-alert>
|
||||
@endif
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col">
|
||||
<x-card id="inviteManagement" card-title="{{ __('Invitation management system') }}" footer-style="text-muted">
|
||||
|
||||
<x-slot name="cardHeader">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" id="inviteUserBtn" class="btn btn-success btn-sm ml-3" data-toggle="modal" data-target="#inviteUserModal">
|
||||
<i class="fas fa-user-plus"></i> {{ __('Invite user') }}
|
||||
</button>
|
||||
</div>
|
||||
@if(\App\Facades\Options::getOption('enable_registrations'))
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" id="inviteUserBtn" class="btn btn-success btn-sm ml-3" disabled>
|
||||
<i class="fas fa-user-plus"></i> {{ __('Invite user') }}
|
||||
</button>
|
||||
</div>
|
||||
@else
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" id="inviteUserBtn" class="btn btn-success btn-sm ml-3" data-toggle="modal" data-target="#inviteUserModal">
|
||||
<i class="fas fa-user-plus"></i> {{ __('Invite user') }}
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</x-slot>
|
||||
|
||||
@if(!empty($invites) && count($invites) > 0)
|
||||
@@ -111,35 +125,37 @@
|
||||
|
||||
</div>
|
||||
|
||||
<x-modal id="inviteUserModal" :modalTitle="__('Invite a User')" :modalLabel="'inviteUserModalLabel'" :includeCloseButton="true">
|
||||
<form method="POST" action="{{ route('invitations.request') }}">
|
||||
@csrf
|
||||
<div class="input-group mt-3">
|
||||
<div class="input-group-prepend">
|
||||
@if(!\App\Facades\Options::getOption('enable_registrations'))
|
||||
<x-modal id="inviteUserModal" :modalTitle="__('Invite a User')" :modalLabel="'inviteUserModalLabel'" :includeCloseButton="true">
|
||||
<form method="POST" action="{{ route('invitations.request') }}">
|
||||
@csrf
|
||||
<div class="input-group mt-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-envelope"></i>
|
||||
</span>
|
||||
</div>
|
||||
<label for="inviteEmail" class="sr-only">{{ __('Email address') }}</label>
|
||||
<input type="email" class="form-control" id="inviteEmail" name="email" required placeholder="{{ __('Enter an email address to send the invite to') }}">
|
||||
</div>
|
||||
<label for="inviteEmail" class="sr-only">{{ __('Email address') }}</label>
|
||||
<input type="email" class="form-control" id="inviteEmail" name="email" required placeholder="{{ __('Enter an email address to send the invite to') }}">
|
||||
</div>
|
||||
<p class="text-muted mt-2 mb-2"><i class="fas fa-info-circle"></i> {{ __('Sending an invite here will immediately create an approved invite request which will in turn send this user an email message with a link. Be aware that this will allow them to register for a new account.') }}</p>
|
||||
</form>
|
||||
<p class="text-muted mt-2 mb-2"><i class="fas fa-info-circle"></i> {{ __('Sending an invite here will immediately create an approved invite request which will in turn send this user an email message with a link. Be aware that this will allow them to register for a new account.') }}</p>
|
||||
</form>
|
||||
|
||||
<x-slot name="modalFooter">
|
||||
<button id="sendInviteBtn" class="btn btn-success" type="button">
|
||||
<i class="fas fa-paper-plane"></i> {{ __('Invite') }}
|
||||
</button>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('sendInviteBtn').addEventListener('click', function () {
|
||||
document.querySelector('#inviteUserModal form').submit();
|
||||
<x-slot name="modalFooter">
|
||||
<button id="sendInviteBtn" class="btn btn-success" type="button">
|
||||
<i class="fas fa-paper-plane"></i> {{ __('Invite') }}
|
||||
</button>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('sendInviteBtn').addEventListener('click', function () {
|
||||
document.querySelector('#inviteUserModal form').submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</x-slot>
|
||||
</script>
|
||||
</x-slot>
|
||||
|
||||
</x-modal>
|
||||
</x-modal>
|
||||
@endif
|
||||
|
||||
@stop
|
||||
|
||||
|
Reference in New Issue
Block a user