mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Clean up references to static Facade.
This commit is contained in:
@@ -34,7 +34,6 @@ use League\Fractal\Manager;
|
|||||||
use League\Fractal\Resource\Collection as FractalCollection;
|
use League\Fractal\Resource\Collection as FractalCollection;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -60,7 +59,7 @@ class PreferenceController extends Controller
|
|||||||
];
|
];
|
||||||
$preferences = new Collection;
|
$preferences = new Collection;
|
||||||
foreach ($available as $name) {
|
foreach ($available as $name) {
|
||||||
$pref = Preferences::getForUser($user, $name);
|
$pref = app('preferences')->getForUser($user, $name);
|
||||||
if (null !== $pref) {
|
if (null !== $pref) {
|
||||||
$preferences->push($pref);
|
$preferences->push($pref);
|
||||||
}
|
}
|
||||||
@@ -130,7 +129,7 @@ class PreferenceController extends Controller
|
|||||||
$newValue = 1 === (int)$data['data'];
|
$newValue = 1 === (int)$data['data'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$result = Preferences::set($preference->name, $newValue);
|
$result = app('preferences')->set($preference->name, $newValue);
|
||||||
|
|
||||||
// create some objects:
|
// create some objects:
|
||||||
$manager = new Manager;
|
$manager = new Manager;
|
||||||
|
@@ -34,7 +34,6 @@ use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CreateImport.
|
* Class CreateImport.
|
||||||
@@ -232,7 +231,7 @@ class CreateImport extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// clear cache for user:
|
// clear cache for user:
|
||||||
Preferences::setForUser($user, 'lastActivity', microtime());
|
app('preferences')->setForUser($user, 'lastActivity', microtime());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,6 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
use Schema;
|
use Schema;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
|
|
||||||
@@ -110,10 +109,10 @@ class UpgradeDatabase extends Command
|
|||||||
{
|
{
|
||||||
foreach (User::get() as $user) {
|
foreach (User::get() as $user) {
|
||||||
/** @var Preference $lang */
|
/** @var Preference $lang */
|
||||||
$lang = Preferences::getForUser($user, 'language', 'en_US');
|
$lang = app('preferences')->getForUser($user, 'language', 'en_US');
|
||||||
$groupName = (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data);
|
$groupName = (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data);
|
||||||
$ruleGroup = $user->ruleGroups()->where('title', $groupName)->first();
|
$ruleGroup = $user->ruleGroups()->where('title', $groupName)->first();
|
||||||
$currencyPreference = Preferences::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
$currencyPreference = app('preferences')->getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||||
|
|
||||||
if (null === $currencyPreference) {
|
if (null === $currencyPreference) {
|
||||||
$this->error('User has no currency preference. Impossible.');
|
$this->error('User has no currency preference. Impossible.');
|
||||||
@@ -294,7 +293,7 @@ class UpgradeDatabase extends Command
|
|||||||
function (Account $account) use ($repository) {
|
function (Account $account) use ($repository) {
|
||||||
$repository->setUser($account->user);
|
$repository->setUser($account->user);
|
||||||
// get users preference, fall back to system pref.
|
// get users preference, fall back to system pref.
|
||||||
$defaultCurrencyCode = Preferences::getForUser($account->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
$defaultCurrencyCode = app('preferences')->getForUser($account->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
||||||
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
|
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
|
||||||
$accountCurrency = (int)$repository->getMetaValue($account, 'currency_id');
|
$accountCurrency = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
$openingBalance = $account->getOpeningBalance();
|
$openingBalance = $account->getOpeningBalance();
|
||||||
|
@@ -25,7 +25,6 @@ namespace FireflyIII\Console\Commands;
|
|||||||
|
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait VerifiesAccessToken.
|
* Trait VerifiesAccessToken.
|
||||||
@@ -61,7 +60,7 @@ trait VerifiesAccessToken
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$accessToken = Preferences::getForUser($user, 'access_token', null);
|
$accessToken = app('preferences')->getForUser($user, 'access_token', null);
|
||||||
if (null === $accessToken) {
|
if (null === $accessToken) {
|
||||||
Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
|
Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
|
||||||
|
|
||||||
|
@@ -42,7 +42,6 @@ use Illuminate\Console\Command;
|
|||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
use Schema;
|
use Schema;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
@@ -106,10 +105,10 @@ class VerifyDatabase extends Command
|
|||||||
$users = User::get();
|
$users = User::get();
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$pref = Preferences::getForUser($user, 'access_token', null);
|
$pref = app('preferences')->getForUser($user, 'access_token', null);
|
||||||
if (null === $pref) {
|
if (null === $pref) {
|
||||||
$token = $user->generateAccessToken();
|
$token = $user->generateAccessToken();
|
||||||
Preferences::setForUser($user, 'access_token', $token);
|
app('preferences')->setForUser($user, 'access_token', $token);
|
||||||
$this->line(sprintf('Generated access token for user %s', $user->email));
|
$this->line(sprintf('Generated access token for user %s', $user->email));
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ use FireflyIII\User;
|
|||||||
use Illuminate\Auth\Events\Login;
|
use Illuminate\Auth\Events\Login;
|
||||||
use Log;
|
use Log;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UserEventHandler.
|
* Class UserEventHandler.
|
||||||
@@ -138,7 +137,7 @@ class UserEventHandler
|
|||||||
$oldEmail = $event->oldEmail;
|
$oldEmail = $event->oldEmail;
|
||||||
$user = $event->user;
|
$user = $event->user;
|
||||||
$ipAddress = $event->ipAddress;
|
$ipAddress = $event->ipAddress;
|
||||||
$token = Preferences::getForUser($user, 'email_change_confirm_token', 'invalid');
|
$token = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid');
|
||||||
$uri = route('profile.confirm-email-change', [$token->data]);
|
$uri = route('profile.confirm-email-change', [$token->data]);
|
||||||
try {
|
try {
|
||||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||||
@@ -164,7 +163,7 @@ class UserEventHandler
|
|||||||
$oldEmail = $event->oldEmail;
|
$oldEmail = $event->oldEmail;
|
||||||
$user = $event->user;
|
$user = $event->user;
|
||||||
$ipAddress = $event->ipAddress;
|
$ipAddress = $event->ipAddress;
|
||||||
$token = Preferences::getForUser($user, 'email_change_undo_token', 'invalid');
|
$token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');
|
||||||
$uri = route('profile.undo-email-change', [$token->data, hash('sha256', $oldEmail)]);
|
$uri = route('profile.undo-email-change', [$token->data, hash('sha256', $oldEmail)]);
|
||||||
try {
|
try {
|
||||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||||
|
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Helpers;
|
namespace FireflyIII\Helpers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FiscalHelper.
|
* Class FiscalHelper.
|
||||||
@@ -38,7 +37,7 @@ class FiscalHelper implements FiscalHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->useCustomFiscalYear = Preferences::get('customFiscalYear', false)->data;
|
$this->useCustomFiscalYear = app('preferences')->get('customFiscalYear', false)->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +71,7 @@ class FiscalHelper implements FiscalHelperInterface
|
|||||||
// get start mm-dd. Then create a start date in the year passed.
|
// get start mm-dd. Then create a start date in the year passed.
|
||||||
$startDate = clone $date;
|
$startDate = clone $date;
|
||||||
if (true === $this->useCustomFiscalYear) {
|
if (true === $this->useCustomFiscalYear) {
|
||||||
$prefStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
|
$prefStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;
|
||||||
[$mth, $day] = explode('-', $prefStartStr);
|
[$mth, $day] = explode('-', $prefStartStr);
|
||||||
$startDate->month((int)$mth)->day((int)$day);
|
$startDate->month((int)$mth)->day((int)$day);
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
*
|
*
|
||||||
* @property string $type
|
* @property string $type
|
||||||
* @method whereType(string $type)
|
* @method whereType(string $type)
|
||||||
* @property int $id
|
* @property int $id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AccountType extends Model
|
class AccountType extends Model
|
||||||
|
@@ -50,7 +50,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property int $skip
|
* @property int $skip
|
||||||
* @property bool $automatch
|
* @property bool $automatch
|
||||||
* @property User $user
|
* @property User $user
|
||||||
* @property string $match
|
* @property string $match
|
||||||
*/
|
*/
|
||||||
class Bill extends Model
|
class Bill extends Model
|
||||||
{
|
{
|
||||||
|
@@ -32,10 +32,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* Class Budget.
|
* Class Budget.
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property-read string $email
|
* @property-read string $email
|
||||||
*/
|
*/
|
||||||
class Budget extends Model
|
class Budget extends Model
|
||||||
|
@@ -40,7 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property string $file_type
|
* @property string $file_type
|
||||||
* @property int $tag_id
|
* @property int $tag_id
|
||||||
* @property Tag $tag
|
* @property Tag $tag
|
||||||
* @property array $errors
|
* @property array $errors
|
||||||
*/
|
*/
|
||||||
class ImportJob extends Model
|
class ImportJob extends Model
|
||||||
{
|
{
|
||||||
|
@@ -34,7 +34,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
* @property string $text
|
* @property string $text
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property int $noteable_id
|
* @property int $noteable_id
|
||||||
*/
|
*/
|
||||||
class Note extends Model
|
class Note extends Model
|
||||||
{
|
{
|
||||||
|
@@ -73,7 +73,7 @@ class RecurrenceTransaction extends Model
|
|||||||
*/
|
*/
|
||||||
public function destinationAccount(): BelongsTo
|
public function destinationAccount(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Account::class,'destination_id');
|
return $this->belongsTo(Account::class, 'destination_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,7 +109,7 @@ class RecurrenceTransaction extends Model
|
|||||||
*/
|
*/
|
||||||
public function sourceAccount(): BelongsTo
|
public function sourceAccount(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Account::class,'source_id');
|
return $this->belongsTo(Account::class, 'source_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -32,14 +32,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* Class RuleGroup.
|
* Class RuleGroup.
|
||||||
*
|
*
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property User $user
|
* @property User $user
|
||||||
* @property Carbon $created_at
|
* @property Carbon $created_at
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property string $text
|
* @property string $text
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $order
|
* @property int $order
|
||||||
* @property Collection $rules
|
* @property Collection $rules
|
||||||
*/
|
*/
|
||||||
class RuleGroup extends Model
|
class RuleGroup extends Model
|
||||||
|
@@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -396,7 +395,7 @@ class TransactionJournal extends Model
|
|||||||
}
|
}
|
||||||
$entry->data = $value;
|
$entry->data = $value;
|
||||||
$entry->save();
|
$entry->save();
|
||||||
Preferences::mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property string $name
|
* @property string $name
|
||||||
* @property int $transaction_journal_id
|
* @property int $transaction_journal_id
|
||||||
* @property TransactionJournal $transactionJournal
|
* @property TransactionJournal $transactionJournal
|
||||||
* @property string $data
|
* @property string $data
|
||||||
* @property int $id
|
* @property int $id
|
||||||
*/
|
*/
|
||||||
class TransactionJournalMeta extends Model
|
class TransactionJournalMeta extends Model
|
||||||
{
|
{
|
||||||
|
@@ -32,7 +32,6 @@ use FireflyIII\Services\Internal\Update\CurrencyUpdateService;
|
|||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CurrencyRepository.
|
* Class CurrencyRepository.
|
||||||
@@ -66,7 +65,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is the default currency for the user or the system
|
// is the default currency for the user or the system
|
||||||
$defaultCode = Preferences::getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
$defaultCode = app('preferences')->getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
||||||
if ($currency->code === $defaultCode) {
|
if ($currency->code === $defaultCode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,6 @@ use FireflyIII\User;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class JournalRepository.
|
* Class JournalRepository.
|
||||||
@@ -107,7 +106,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$journal->save();
|
$journal->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences::mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
return new MessageBag;
|
return new MessageBag;
|
||||||
}
|
}
|
||||||
|
@@ -63,13 +63,6 @@ interface LinkTypeRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function find(int $id): LinkType;
|
public function find(int $id): LinkType;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the user for this instance.
|
|
||||||
*
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find link type by name.
|
* Find link type by name.
|
||||||
*
|
*
|
||||||
@@ -128,6 +121,13 @@ interface LinkTypeRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getLinks(TransactionJournal $journal): Collection;
|
public function getLinks(TransactionJournal $journal): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the user for this instance.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
|
@@ -27,7 +27,6 @@ use FireflyIII\Models\Role;
|
|||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UserRepository.
|
* Class UserRepository.
|
||||||
@@ -73,12 +72,12 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
$oldEmail = $user->email;
|
$oldEmail = $user->email;
|
||||||
|
|
||||||
// save old email as pref
|
// save old email as pref
|
||||||
Preferences::setForUser($user, 'previous_email_latest', $oldEmail);
|
app('preferences')->setForUser($user, 'previous_email_latest', $oldEmail);
|
||||||
Preferences::setForUser($user, 'previous_email_' . date('Y-m-d-H-i-s'), $oldEmail);
|
app('preferences')->setForUser($user, 'previous_email_' . date('Y-m-d-H-i-s'), $oldEmail);
|
||||||
|
|
||||||
// set undo and confirm token:
|
// set undo and confirm token:
|
||||||
Preferences::setForUser($user, 'email_change_undo_token', (string)bin2hex(random_bytes(16)));
|
app('preferences')->setForUser($user, 'email_change_undo_token', (string)bin2hex(random_bytes(16)));
|
||||||
Preferences::setForUser($user, 'email_change_confirm_token', (string)bin2hex(random_bytes(16)));
|
app('preferences')->setForUser($user, 'email_change_confirm_token', (string)bin2hex(random_bytes(16)));
|
||||||
// update user
|
// update user
|
||||||
|
|
||||||
$user->email = $newEmail;
|
$user->email = $newEmail;
|
||||||
@@ -222,8 +221,8 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
// two factor:
|
// two factor:
|
||||||
$is2faEnabled = Preferences::getForUser($user, 'twoFactorAuthEnabled', false)->data;
|
$is2faEnabled = app('preferences')->getForUser($user, 'twoFactorAuthEnabled', false)->data;
|
||||||
$has2faSecret = null !== Preferences::getForUser($user, 'twoFactorAuthSecret');
|
$has2faSecret = null !== app('preferences')->getForUser($user, 'twoFactorAuthSecret');
|
||||||
$return['has_2fa'] = false;
|
$return['has_2fa'] = false;
|
||||||
if ($is2faEnabled && $has2faSecret) {
|
if ($is2faEnabled && $has2faSecret) {
|
||||||
$return['has_2fa'] = true;
|
$return['has_2fa'] = true;
|
||||||
@@ -329,8 +328,8 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
$oldEmail = $user->email;
|
$oldEmail = $user->email;
|
||||||
|
|
||||||
// save old email as pref
|
// save old email as pref
|
||||||
Preferences::setForUser($user, 'admin_previous_email_latest', $oldEmail);
|
app('preferences')->setForUser($user, 'admin_previous_email_latest', $oldEmail);
|
||||||
Preferences::setForUser($user, 'admin_previous_email_' . date('Y-m-d-H-i-s'), $oldEmail);
|
app('preferences')->setForUser($user, 'admin_previous_email_' . date('Y-m-d-H-i-s'), $oldEmail);
|
||||||
|
|
||||||
$user->email = $newEmail;
|
$user->email = $newEmail;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
@@ -123,9 +123,9 @@ class BunqInformation implements InformationInterface
|
|||||||
private function closeSession(SessionToken $sessionToken): void
|
private function closeSession(SessionToken $sessionToken): void
|
||||||
{
|
{
|
||||||
Log::debug('Going to close session');
|
Log::debug('Going to close session');
|
||||||
$apiKey = Preferences::getForUser($this->user, 'bunq_api_key')->data;
|
$apiKey = app('preferences')->getForUser($this->user, 'bunq_api_key')->data;
|
||||||
$serverPublicKey = Preferences::getForUser($this->user, 'bunq_server_public_key')->data;
|
$serverPublicKey = app('preferences')->getForUser($this->user, 'bunq_server_public_key')->data;
|
||||||
$privateKey = Preferences::getForUser($this->user, 'bunq_private_key')->data;
|
$privateKey = app('preferences')->getForUser($this->user, 'bunq_private_key')->data;
|
||||||
$request = new DeleteDeviceSessionRequest();
|
$request = new DeleteDeviceSessionRequest();
|
||||||
$request->setSecret($apiKey);
|
$request->setSecret($apiKey);
|
||||||
$request->setPrivateKey($privateKey);
|
$request->setPrivateKey($privateKey);
|
||||||
@@ -144,9 +144,9 @@ class BunqInformation implements InformationInterface
|
|||||||
*/
|
*/
|
||||||
private function getMonetaryAccounts(SessionToken $sessionToken, int $userId): Collection
|
private function getMonetaryAccounts(SessionToken $sessionToken, int $userId): Collection
|
||||||
{
|
{
|
||||||
$apiKey = Preferences::getForUser($this->user, 'bunq_api_key')->data;
|
$apiKey = app('preferences')->getForUser($this->user, 'bunq_api_key')->data;
|
||||||
$serverPublicKey = Preferences::getForUser($this->user, 'bunq_server_public_key')->data;
|
$serverPublicKey = app('preferences')->getForUser($this->user, 'bunq_server_public_key')->data;
|
||||||
$privateKey = Preferences::getForUser($this->user, 'bunq_private_key')->data;
|
$privateKey = app('preferences')->getForUser($this->user, 'bunq_private_key')->data;
|
||||||
$request = new ListMonetaryAccountRequest;
|
$request = new ListMonetaryAccountRequest;
|
||||||
|
|
||||||
$request->setSessionToken($sessionToken);
|
$request->setSessionToken($sessionToken);
|
||||||
@@ -168,9 +168,9 @@ class BunqInformation implements InformationInterface
|
|||||||
*/
|
*/
|
||||||
private function getUserInformation(SessionToken $sessionToken): int
|
private function getUserInformation(SessionToken $sessionToken): int
|
||||||
{
|
{
|
||||||
$apiKey = Preferences::getForUser($this->user, 'bunq_api_key')->data;
|
$apiKey = app('preferences')->getForUser($this->user, 'bunq_api_key')->data;
|
||||||
$serverPublicKey = Preferences::getForUser($this->user, 'bunq_server_public_key')->data;
|
$serverPublicKey = app('preferences')->getForUser($this->user, 'bunq_server_public_key')->data;
|
||||||
$privateKey = Preferences::getForUser($this->user, 'bunq_private_key')->data;
|
$privateKey = app('preferences')->getForUser($this->user, 'bunq_private_key')->data;
|
||||||
$request = new ListUserRequest;
|
$request = new ListUserRequest;
|
||||||
$request->setSessionToken($sessionToken);
|
$request->setSessionToken($sessionToken);
|
||||||
$request->setSecret($apiKey);
|
$request->setSecret($apiKey);
|
||||||
@@ -196,10 +196,10 @@ class BunqInformation implements InformationInterface
|
|||||||
private function startSession(): SessionToken
|
private function startSession(): SessionToken
|
||||||
{
|
{
|
||||||
Log::debug('Now in startSession.');
|
Log::debug('Now in startSession.');
|
||||||
$apiKey = Preferences::getForUser($this->user, 'bunq_api_key')->data;
|
$apiKey = app('preferences')->getForUser($this->user, 'bunq_api_key')->data;
|
||||||
$serverPublicKey = Preferences::getForUser($this->user, 'bunq_server_public_key')->data;
|
$serverPublicKey = app('preferences')->getForUser($this->user, 'bunq_server_public_key')->data;
|
||||||
$privateKey = Preferences::getForUser($this->user, 'bunq_private_key')->data;
|
$privateKey = app('preferences')->getForUser($this->user, 'bunq_private_key')->data;
|
||||||
$installationToken = Preferences::getForUser($this->user, 'bunq_installation_token')->data;
|
$installationToken = app('preferences')->getForUser($this->user, 'bunq_installation_token')->data;
|
||||||
$request = new DeviceSessionRequest();
|
$request = new DeviceSessionRequest();
|
||||||
$request->setSecret($apiKey);
|
$request->setSecret($apiKey);
|
||||||
$request->setServerPublicKey($serverPublicKey);
|
$request->setServerPublicKey($serverPublicKey);
|
||||||
|
Reference in New Issue
Block a user