mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Some code cleanup.
This commit is contained in:
@@ -7,7 +7,6 @@ use Auth;
|
|||||||
use FireflyIII\Events\UserRegistration;
|
use FireflyIII\Events\UserRegistration;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||||
use Illuminate\Foundation\Auth\ThrottlesLogins;
|
use Illuminate\Foundation\Auth\ThrottlesLogins;
|
||||||
|
@@ -41,8 +41,8 @@ class Controller extends BaseController
|
|||||||
View::share('hideTags', false);
|
View::share('hideTags', false);
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
|
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
|
||||||
$lang = $pref->data;
|
$lang = $pref->data;
|
||||||
|
|
||||||
App::setLocale($lang);
|
App::setLocale($lang);
|
||||||
Carbon::setLocale(substr($lang, 0, 2));
|
Carbon::setLocale(substr($lang, 0, 2));
|
||||||
|
@@ -50,7 +50,7 @@ class Kernel extends HttpKernel
|
|||||||
// does not check login
|
// does not check login
|
||||||
// does not check 2fa
|
// does not check 2fa
|
||||||
// does not check activation
|
// does not check activation
|
||||||
'web' => [
|
'web' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
@@ -58,7 +58,7 @@ class Kernel extends HttpKernel
|
|||||||
VerifyCsrfToken::class,
|
VerifyCsrfToken::class,
|
||||||
],
|
],
|
||||||
// MUST NOT be logged in. Does not care about 2FA or confirmation.
|
// MUST NOT be logged in. Does not care about 2FA or confirmation.
|
||||||
'user-not-logged-in' => [
|
'user-not-logged-in' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
@@ -70,7 +70,7 @@ class Kernel extends HttpKernel
|
|||||||
// MUST be logged in.
|
// MUST be logged in.
|
||||||
// MUST NOT have 2FA
|
// MUST NOT have 2FA
|
||||||
// don't care about confirmation:
|
// don't care about confirmation:
|
||||||
'user-logged-in-no-2fa' => [
|
'user-logged-in-no-2fa' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
@@ -82,7 +82,7 @@ class Kernel extends HttpKernel
|
|||||||
// MUST be logged in
|
// MUST be logged in
|
||||||
// MUST have 2FA
|
// MUST have 2FA
|
||||||
// MUST NOT have confirmation.
|
// MUST NOT have confirmation.
|
||||||
'user-logged-in-2fa-no-activation' => [
|
'user-logged-in-2fa-no-activation' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
@@ -96,7 +96,7 @@ class Kernel extends HttpKernel
|
|||||||
// MUST be logged in
|
// MUST be logged in
|
||||||
// don't care about 2fa
|
// don't care about 2fa
|
||||||
// don't care about confirmation.
|
// don't care about confirmation.
|
||||||
'user-simple-auth' => [
|
'user-simple-auth' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
@@ -109,7 +109,7 @@ class Kernel extends HttpKernel
|
|||||||
// MUST have 2fa
|
// MUST have 2fa
|
||||||
// MUST be confirmed.
|
// MUST be confirmed.
|
||||||
// (this group includes the other Firefly middleware)
|
// (this group includes the other Firefly middleware)
|
||||||
'user-full-auth' => [
|
'user-full-auth' => [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
StartSession::class,
|
StartSession::class,
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These routes only work when the user is NOT logged in.
|
* These routes only work when the user is NOT logged in.
|
||||||
*/
|
*/
|
||||||
|
@@ -28,7 +28,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property \Carbon\Carbon $nextExpectedMatch
|
* @property \Carbon\Carbon $nextExpectedMatch
|
||||||
* @property \Carbon\Carbon $lastFoundMatch
|
* @property \Carbon\Carbon $lastFoundMatch
|
||||||
* @property bool $paidInPeriod
|
* @property bool $paidInPeriod
|
||||||
* @property string $lastPaidAmount
|
* @property string $lastPaidAmount
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
|
||||||
@@ -51,7 +51,8 @@ class Bill extends Model
|
|||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
protected $dates = ['created_at', 'updated_at', 'date'];
|
||||||
protected $fillable
|
protected $fillable
|
||||||
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active',];
|
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
||||||
|
'automatch', 'active',];
|
||||||
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
|
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -466,7 +466,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$description = strtolower($journal->description) . ' ' . strtolower(TransactionJournal::destinationAccount($journal)->name);
|
$description = strtolower($journal->description) . ' ' . strtolower(TransactionJournal::destinationAccount($journal)->name);
|
||||||
|
|
||||||
// new: add source to word match:
|
// new: add source to word match:
|
||||||
$description .= ' '.strtolower(TransactionJournal::sourceAccount($journal)->name);
|
$description .= ' ' . strtolower(TransactionJournal::sourceAccount($journal)->name);
|
||||||
|
|
||||||
$wordMatch = $this->doWordMatch($matches, $description);
|
$wordMatch = $this->doWordMatch($matches, $description);
|
||||||
$amountMatch = $this->doAmountMatch(TransactionJournal::amountPositive($journal), $bill->amount_min, $bill->amount_max);
|
$amountMatch = $this->doAmountMatch(TransactionJournal::amountPositive($journal), $bill->amount_min, $bill->amount_max);
|
||||||
|
@@ -60,7 +60,7 @@ class FireflyValidator extends Validator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$secret = Session::get('two-factor-secret');
|
$secret = Session::get('two-factor-secret');
|
||||||
/** @var Google2FA $google2fa */
|
/** @var Google2FA $google2fa */
|
||||||
$google2fa = app('PragmaRX\Google2FA\Google2FA');
|
$google2fa = app('PragmaRX\Google2FA\Google2FA');
|
||||||
|
|
||||||
|
@@ -6,8 +6,6 @@ use FireflyIII\User;
|
|||||||
/**
|
/**
|
||||||
* Class TestCase
|
* Class TestCase
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -39,8 +37,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
if ($range === 'custom') {
|
if ($range === 'custom') {
|
||||||
$this->session(
|
$this->session(
|
||||||
[
|
[
|
||||||
'start' => Carbon::now()->subDays(20),
|
'start' => Carbon::now()->subDays(20),
|
||||||
'end' => Carbon::now(),
|
'end' => Carbon::now(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user