Merge pull request #7176 from firefly-iii/fix-7175

Fixes #7175
This commit is contained in:
James Cole 2023-03-09 06:34:09 +01:00 committed by GitHub
commit 2e89586559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 138 additions and 44 deletions

View File

@ -28,10 +28,12 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Requests\InviteUserFormRequest; use FireflyIII\Http\Requests\InviteUserFormRequest;
use FireflyIII\Http\Requests\UserFormRequest; use FireflyIII\Http\Requests\UserFormRequest;
use FireflyIII\Models\InvitedUser;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
@ -87,6 +89,24 @@ class UserController extends Controller
return view('admin.users.delete', compact('user', 'subTitle')); return view('admin.users.delete', compact('user', 'subTitle'));
} }
/**
* @param InvitedUser $invitedUser
* @return RedirectResponse
*/
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
{
Log::debug('Will now delete invitation');
if ($invitedUser->redeemed) {
Log::debug('Is already redeemed.');
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));
return response()->json(['success' => false]);
}
Log::debug('Delete!');
session()->flash('success', trans('firefly.invite_is_deleted', ['address' => $invitedUser->email]));
$this->repository->deleteInvite($invitedUser);
return response()->json(['success' => true]);
}
/** /**
* Destroy a user. * Destroy a user.
* *

View File

@ -90,7 +90,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static EloquentBuilder|Account whereVirtualBalance($value) * @method static EloquentBuilder|Account whereVirtualBalance($value)
* @method static Builder|Account withTrashed() * @method static Builder|Account withTrashed()
* @method static Builder|Account withoutTrashed() * @method static Builder|Account withoutTrashed()
* @mixin Eloquent
* @property Carbon $lastActivityDate * @property Carbon $lastActivityDate
* @property string $startBalance * @property string $startBalance
* @property string $endBalance * @property string $endBalance
@ -103,6 +102,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $current_debt * @property string $current_debt
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static EloquentBuilder|Account whereUserGroupId($value) * @method static EloquentBuilder|Account whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Account extends Model class Account extends Model
{ {

View File

@ -78,9 +78,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserId($value)
* @method static Builder|Attachment withTrashed() * @method static Builder|Attachment withTrashed()
* @method static Builder|Attachment withoutTrashed() * @method static Builder|Attachment withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Attachment extends Model class Attachment extends Model
{ {

View File

@ -42,7 +42,6 @@ use Illuminate\Support\Carbon;
* @method static Builder|AuditLogEntry query() * @method static Builder|AuditLogEntry query()
* @method static \Illuminate\Database\Query\Builder|AuditLogEntry withTrashed() * @method static \Illuminate\Database\Query\Builder|AuditLogEntry withTrashed()
* @method static \Illuminate\Database\Query\Builder|AuditLogEntry withoutTrashed() * @method static \Illuminate\Database\Query\Builder|AuditLogEntry withoutTrashed()
* @mixin Eloquent
* @property int $id * @property int $id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
@ -65,6 +64,7 @@ use Illuminate\Support\Carbon;
* @method static Builder|AuditLogEntry whereDeletedAt($value) * @method static Builder|AuditLogEntry whereDeletedAt($value)
* @method static Builder|AuditLogEntry whereId($value) * @method static Builder|AuditLogEntry whereId($value)
* @method static Builder|AuditLogEntry whereUpdatedAt($value) * @method static Builder|AuditLogEntry whereUpdatedAt($value)
* @mixin Eloquent
*/ */
class AuditLogEntry extends Model class AuditLogEntry extends Model
{ {

View File

@ -62,9 +62,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserId($value)
* @method static Builder|AvailableBudget withTrashed() * @method static Builder|AvailableBudget withTrashed()
* @method static Builder|AvailableBudget withoutTrashed() * @method static Builder|AvailableBudget withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserGroupId($value)
* @mixin Eloquent
*/ */
class AvailableBudget extends Model class AvailableBudget extends Model
{ {

View File

@ -95,9 +95,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Bill whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Bill whereUserId($value)
* @method static Builder|Bill withTrashed() * @method static Builder|Bill withTrashed()
* @method static Builder|Bill withoutTrashed() * @method static Builder|Bill withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Bill whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Bill whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Bill extends Model class Bill extends Model
{ {

View File

@ -74,12 +74,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserId($value)
* @method static Builder|Budget withTrashed() * @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed() * @method static Builder|Budget withoutTrashed()
* @mixin Eloquent
* @property string $email * @property string $email
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserGroupId($value)
* @property-read Collection|Note[] $notes * @property-read Collection|Note[] $notes
* @property-read int|null $notes_count * @property-read int|null $notes_count
* @mixin Eloquent
*/ */
class Budget extends Model class Budget extends Model
{ {

View File

@ -68,9 +68,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Category whereUserId($value)
* @method static Builder|Category withTrashed() * @method static Builder|Category withTrashed()
* @method static Builder|Category withoutTrashed() * @method static Builder|Category withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Category whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Category extends Model class Category extends Model
{ {

View File

@ -60,9 +60,9 @@ use Illuminate\Support\Carbon;
* @method static Builder|CurrencyExchangeRate whereUpdatedAt($value) * @method static Builder|CurrencyExchangeRate whereUpdatedAt($value)
* @method static Builder|CurrencyExchangeRate whereUserId($value) * @method static Builder|CurrencyExchangeRate whereUserId($value)
* @method static Builder|CurrencyExchangeRate whereUserRate($value) * @method static Builder|CurrencyExchangeRate whereUserRate($value)
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static Builder|CurrencyExchangeRate whereUserGroupId($value) * @method static Builder|CurrencyExchangeRate whereUserGroupId($value)
* @mixin Eloquent
*/ */
class CurrencyExchangeRate extends Model class CurrencyExchangeRate extends Model
{ {

View File

@ -30,6 +30,7 @@ use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* Class InvitedUser * Class InvitedUser
@ -38,7 +39,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @method static Builder|InvitedUser newModelQuery() * @method static Builder|InvitedUser newModelQuery()
* @method static Builder|InvitedUser newQuery() * @method static Builder|InvitedUser newQuery()
* @method static Builder|InvitedUser query() * @method static Builder|InvitedUser query()
* @mixin Eloquent
* @property int $id * @property int $id
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
@ -55,6 +55,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @method static Builder|InvitedUser whereRedeemed($value) * @method static Builder|InvitedUser whereRedeemed($value)
* @method static Builder|InvitedUser whereUpdatedAt($value) * @method static Builder|InvitedUser whereUpdatedAt($value)
* @method static Builder|InvitedUser whereUserId($value) * @method static Builder|InvitedUser whereUserId($value)
* @mixin Eloquent
*/ */
class InvitedUser extends Model class InvitedUser extends Model
{ {
@ -72,4 +73,25 @@ class InvitedUser extends Model
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);
} }
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
*
* @param string $value
*
* @return WebhookAttempt
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): InvitedUser
{
if (auth()->check()) {
$attemptId = (int)$value;
/** @var InvitedUser $attempt */
$attempt = self::find($attemptId);
if (null !== $attempt) {
return $attempt;
}
}
throw new NotFoundHttpException();
}
} }

View File

@ -85,9 +85,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserId($value)
* @method static Builder|Recurrence withTrashed() * @method static Builder|Recurrence withTrashed()
* @method static Builder|Recurrence withoutTrashed() * @method static Builder|Recurrence withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Recurrence extends Model class Recurrence extends Model
{ {

View File

@ -73,10 +73,10 @@ use Illuminate\Support\Carbon;
* @method static \Illuminate\Database\Eloquent\Builder|RecurrenceTransaction whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|RecurrenceTransaction whereUpdatedAt($value)
* @method static Builder|RecurrenceTransaction withTrashed() * @method static Builder|RecurrenceTransaction withTrashed()
* @method static Builder|RecurrenceTransaction withoutTrashed() * @method static Builder|RecurrenceTransaction withoutTrashed()
* @mixin Eloquent
* @property int|null $transaction_type_id * @property int|null $transaction_type_id
* @method static \Illuminate\Database\Eloquent\Builder|RecurrenceTransaction whereTransactionTypeId($value) * @method static \Illuminate\Database\Eloquent\Builder|RecurrenceTransaction whereTransactionTypeId($value)
* @property-read TransactionType|null $transactionType * @property-read TransactionType|null $transactionType
* @mixin Eloquent
*/ */
class RecurrenceTransaction extends Model class RecurrenceTransaction extends Model
{ {

View File

@ -74,9 +74,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserId($value)
* @method static Builder|Rule withTrashed() * @method static Builder|Rule withTrashed()
* @method static Builder|Rule withoutTrashed() * @method static Builder|Rule withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Rule extends Model class Rule extends Model
{ {

View File

@ -66,9 +66,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserId($value)
* @method static Builder|RuleGroup withTrashed() * @method static Builder|RuleGroup withTrashed()
* @method static Builder|RuleGroup withoutTrashed() * @method static Builder|RuleGroup withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserGroupId($value)
* @mixin Eloquent
*/ */
class RuleGroup extends Model class RuleGroup extends Model
{ {

View File

@ -75,9 +75,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereZoomLevel($value) * @method static \Illuminate\Database\Eloquent\Builder|Tag whereZoomLevel($value)
* @method static Builder|Tag withTrashed() * @method static Builder|Tag withTrashed()
* @method static Builder|Tag withoutTrashed() * @method static Builder|Tag withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|Tag whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Tag extends Model class Tag extends Model
{ {

View File

@ -84,8 +84,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static Builder|Transaction whereUpdatedAt($value) * @method static Builder|Transaction whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed() * @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed() * @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
* @mixin Eloquent
* @property int $the_count * @property int $the_count
* @mixin Eloquent
*/ */
class Transaction extends Model class Transaction extends Model
{ {

View File

@ -59,9 +59,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserId($value)
* @method static Builder|TransactionGroup withTrashed() * @method static Builder|TransactionGroup withTrashed()
* @method static Builder|TransactionGroup withoutTrashed() * @method static Builder|TransactionGroup withoutTrashed()
* @mixin Eloquent
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserGroupId($value) * @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserGroupId($value)
* @mixin Eloquent
*/ */
class TransactionGroup extends Model class TransactionGroup extends Model
{ {

View File

@ -112,12 +112,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static EloquentBuilder|TransactionJournal whereUserId($value) * @method static EloquentBuilder|TransactionJournal whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withTrashed() * @method static \Illuminate\Database\Query\Builder|TransactionJournal withTrashed()
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed() * @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()
* @mixin Eloquent
* @property-read Collection|Location[] $locations * @property-read Collection|Location[] $locations
* @property-read int|null $locations_count * @property-read int|null $locations_count
* @property int $the_count * @property int $the_count
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value) * @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
* @mixin Eloquent
*/ */
class TransactionJournal extends Model class TransactionJournal extends Model
{ {

View File

@ -69,13 +69,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Webhook whereUserId($value) * @method static Builder|Webhook whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|Webhook withTrashed() * @method static \Illuminate\Database\Query\Builder|Webhook withTrashed()
* @method static \Illuminate\Database\Query\Builder|Webhook withoutTrashed() * @method static \Illuminate\Database\Query\Builder|Webhook withoutTrashed()
* @mixin Eloquent
* @property string $title * @property string $title
* @property string $secret * @property string $secret
* @method static Builder|Webhook whereSecret($value) * @method static Builder|Webhook whereSecret($value)
* @method static Builder|Webhook whereTitle($value) * @method static Builder|Webhook whereTitle($value)
* @property int|null $user_group_id * @property int|null $user_group_id
* @method static Builder|Webhook whereUserGroupId($value) * @method static Builder|Webhook whereUserGroupId($value)
* @mixin Eloquent
*/ */
class Webhook extends Model class Webhook extends Model
{ {

View File

@ -55,10 +55,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereStatusCode($value) * @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereStatusCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereWebhookMessageId($value) * @method static \Illuminate\Database\Eloquent\Builder|WebhookAttempt whereWebhookMessageId($value)
* @mixin Eloquent
* @method static Builder|WebhookAttempt onlyTrashed() * @method static Builder|WebhookAttempt onlyTrashed()
* @method static Builder|WebhookAttempt withTrashed() * @method static Builder|WebhookAttempt withTrashed()
* @method static Builder|WebhookAttempt withoutTrashed() * @method static Builder|WebhookAttempt withoutTrashed()
* @mixin Eloquent
*/ */
class WebhookAttempt extends Model class WebhookAttempt extends Model
{ {

View File

@ -63,9 +63,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|WebhookMessage whereUpdatedAt($value) * @method static Builder|WebhookMessage whereUpdatedAt($value)
* @method static Builder|WebhookMessage whereUuid($value) * @method static Builder|WebhookMessage whereUuid($value)
* @method static Builder|WebhookMessage whereWebhookId($value) * @method static Builder|WebhookMessage whereWebhookId($value)
* @mixin Eloquent
* @property-read Collection|WebhookAttempt[] $webhookAttempts * @property-read Collection|WebhookAttempt[] $webhookAttempts
* @property-read int|null $webhook_attempts_count * @property-read int|null $webhook_attempts_count
* @mixin Eloquent
*/ */
class WebhookMessage extends Model class WebhookMessage extends Model
{ {

View File

@ -119,6 +119,15 @@ class UserRepository implements UserRepositoryInterface
return Role::create(['name' => $name, 'display_name' => $displayName, 'description' => $description]); return Role::create(['name' => $name, 'display_name' => $displayName, 'description' => $description]);
} }
/**
* @inheritDoc
*/
public function deleteInvite(InvitedUser $invite): void
{
Log::debug(sprintf('Deleting invite #%d', $invite->id));
$invite->delete();
}
/** /**
* @param User $user * @param User $user
* *

View File

@ -102,6 +102,12 @@ interface UserRepositoryInterface
*/ */
public function deleteEmptyGroups(): void; public function deleteEmptyGroups(): void;
/**
* @param InvitedUser $invite
* @return void
*/
public function deleteInvite(InvitedUser $invite): void;
/** /**
* @param User $user * @param User $user
* *

View File

@ -122,7 +122,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|User whereRememberToken($value) * @method static Builder|User whereRememberToken($value)
* @method static Builder|User whereReset($value) * @method static Builder|User whereReset($value)
* @method static Builder|User whereUpdatedAt($value) * @method static Builder|User whereUpdatedAt($value)
* @mixin Eloquent
* @property string|null $objectguid * @property string|null $objectguid
* @property-read int|null $accounts_count * @property-read int|null $accounts_count
* @property-read int|null $attachments_count * @property-read int|null $attachments_count
@ -165,6 +164,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property-read int|null $group_memberships_count * @property-read int|null $group_memberships_count
* @property-read UserGroup|null $userGroup * @property-read UserGroup|null $userGroup
* @method static Builder|User whereUserGroupId($value) * @method static Builder|User whereUserGroupId($value)
* @mixin Eloquent
*/ */
class User extends Authenticatable class User extends Authenticatable
{ {

View File

@ -31,6 +31,7 @@ use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use FireflyIII\Models\InvitedUser;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use FireflyIII\Models\ObjectGroup; use FireflyIII\Models\ObjectGroup;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
@ -445,6 +446,7 @@ return [
'webhook' => Webhook::class, 'webhook' => Webhook::class,
'webhookMessage' => WebhookMessage::class, 'webhookMessage' => WebhookMessage::class,
'webhookAttempt' => WebhookAttempt::class, 'webhookAttempt' => WebhookAttempt::class,
'invitedUser' => InvitedUser::class,
// strings // strings
'currency_code' => CurrencyCode::class, 'currency_code' => CurrencyCode::class,
@ -470,6 +472,7 @@ return [
'dynamicConfigKey' => DynamicConfigKey::class, 'dynamicConfigKey' => DynamicConfigKey::class,
'eitherConfigKey' => EitherConfigKey::class, 'eitherConfigKey' => EitherConfigKey::class,
], ],
'rule-actions' => [ 'rule-actions' => [
'set_category' => SetCategory::class, 'set_category' => SetCategory::class,

33
public/v1/js/ff/admin/users.js vendored Normal file
View File

@ -0,0 +1,33 @@
/*
* users.js
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$(function () {
"use strict";
$('.delete-invite').on('click', deleteInvite);
});
function deleteInvite(e) {
let link = $(e.currentTarget);
$.post(link.attr('href'), {_token: token}).then(function () {
location.reload();
});
return false;
}

View File

@ -224,7 +224,6 @@ function deleteBudgetLimit(e) {
var url = deleteBudgetLimitUrl.replace('REPLACEME', budgetLimitId.toString()); var url = deleteBudgetLimitUrl.replace('REPLACEME', budgetLimitId.toString());
$.post(url, {_token: token}).then(function () { $.post(url, {_token: token}).then(function () {
$('.bl_entry[data-budget-limit-id="' + budgetLimitId + '"]').remove(); $('.bl_entry[data-budget-limit-id="' + budgetLimitId + '"]').remove();
}); });
return false; return false;
} }

View File

@ -2274,6 +2274,8 @@ return [
// Ignore this comment // Ignore this comment
// administration // administration
'invite_is_already_redeemed' => 'The invite to ":address" has already been redeemed.',
'invite_is_deleted' => 'The invite to ":address" has been deleted.',
'invite_new_user_title' => 'Invite new user', 'invite_new_user_title' => 'Invite new user',
'invite_new_user_text' => 'As an administrator, you can invite users to register on your Firefly III administration. Using the direct link you can share with them, they will be able to register an account. The invited user and their invite link will appear in the table below. You are free to share the invitation link with them.', 'invite_new_user_text' => 'As an administrator, you can invite users to register on your Firefly III administration. Using the direct link you can share with them, they will be able to register an account. The invited user and their invite link will appear in the table below. You are free to share the invitation link with them.',
'invited_user_mail' => 'Email address', 'invited_user_mail' => 'Email address',

View File

@ -137,7 +137,7 @@
<tr> <tr>
<td class="hidden-xs" data-value="{{ user.id }}"> <td class="hidden-xs" data-value="{{ user.id }}">
<div class="btn-group btn-group-xs"> <div class="btn-group btn-group-xs">
<a class="btn btn-danger" href="{{ route('admin.users.delete-invite', invitee.id) }}"><span <a class="btn btn-danger delete-invite" href="{{ route('admin.users.delete-invite', invitee.id) }}"><span
class="fa fa-trash"></span></a> class="fa fa-trash"></span></a>
</div> </div>
</td> </td>
@ -178,6 +178,6 @@
nonce="{{ JS_NONCE }}"> nonce="{{ JS_NONCE }}">
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}" <script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
nonce="{{ JS_NONCE }}"></script> <script type="text/javascript" src="v1/js/ff/admin/users.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
{% endblock %} {% endblock %}

View File

@ -1341,8 +1341,8 @@ Route::group(
Route::post('users/destroy/{user}', ['uses' => 'UserController@destroy', 'as' => 'users.destroy']); Route::post('users/destroy/{user}', ['uses' => 'UserController@destroy', 'as' => 'users.destroy']);
// invitee management // invitee management
Route::get('users/delete_invite/{invitedUser}', ['uses' => 'UserController@deleteInvite', 'as' => 'users.delete-invite']);
Route::post('users/invite', ['uses' => 'UserController@invite', 'as' => 'users.invite']); Route::post('users/invite', ['uses' => 'UserController@invite', 'as' => 'users.invite']);
Route::post('users/delete-invite/{invitedUser}', ['uses' => 'UserController@deleteInvite', 'as' => 'users.delete-invite']);
// journal links manager // journal links manager
Route::get('links', ['uses' => 'LinkController@index', 'as' => 'links.index']); Route::get('links', ['uses' => 'LinkController@index', 'as' => 'links.index']);