mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-24 08:00:12 -06:00
Some code fixes.
This commit is contained in:
parent
6e33e26ddf
commit
5ca9099654
@ -18,7 +18,7 @@ use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Validation\ValidationException as ValException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
@ -40,7 +40,7 @@ class Handler extends ExceptionHandler
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
TokenMismatchException::class,
|
||||
ValidationException::class,
|
||||
ValException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
public function getAttachmentLocation(Attachment $attachment): string
|
||||
{
|
||||
$path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';
|
||||
$path = sprintf('%s%sat-%d.data', storage_path('upload'), DIRECTORY_SEPARATOR, $attachment->id);
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class ForgotPasswordController extends Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
|
@ -421,6 +421,7 @@ class ImportController extends Controller
|
||||
{
|
||||
// create proper importer (depends on job)
|
||||
$type = $job->file_type;
|
||||
|
||||
/** @var SetupInterface $importer */
|
||||
$importer = app('FireflyIII\Import\Setup\\' . ucfirst($type) . 'Setup');
|
||||
$importer->setJob($job);
|
||||
|
@ -226,7 +226,7 @@ class TagController extends Controller
|
||||
$subTitle = $tag->tag;
|
||||
$subTitleIcon = 'fa-tag';
|
||||
|
||||
// TODO move to repository.
|
||||
|
||||
|
||||
/** @var Collection $journals */
|
||||
$journals = $tag
|
||||
|
@ -124,8 +124,9 @@ class CsvImporter implements ImporterInterface
|
||||
$doMap = $config['column-do-mapping'][$rowIndex] ?? false;
|
||||
$converterClass = config('csv.import_roles.' . $role . '.converter');
|
||||
$mapping = $config['column-mapping-config'][$rowIndex] ?? [];
|
||||
$className = sprintf('FireflyIII\\Import\\Converter\\%s', $converterClass);
|
||||
/** @var ConverterInterface $converter */
|
||||
$converter = app('FireflyIII\\Import\\Converter\\' . $converterClass);
|
||||
$converter = app($className);
|
||||
// set some useful values for the converter:
|
||||
$converter->setMapping($mapping);
|
||||
$converter->setDoMap($doMap);
|
||||
|
@ -216,7 +216,11 @@ class CsvSetup implements SetupInterface
|
||||
// loop specifics.
|
||||
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
||||
foreach ($data['specifics'] as $name => $enabled) {
|
||||
$config['specifics'][$name] = 1;
|
||||
// verify their content.
|
||||
$className = sprintf('FireflyIII\Import\Specifics\%s', $name);
|
||||
if (class_exists($className)) {
|
||||
$config['specifics'][$name] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->job->configuration = $config;
|
||||
|
@ -11,6 +11,7 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Repositories\ImportJob;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Str;
|
||||
@ -42,7 +43,13 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
*/
|
||||
public function create(string $fileType): ImportJob
|
||||
{
|
||||
$count = 0;
|
||||
$count = 0;
|
||||
$fileType = strtolower($fileType);
|
||||
$keys = array_keys(config('firefly.import_formats'));
|
||||
if (!in_array($fileType, $keys)) {
|
||||
throw new FireflyException(sprintf('Cannot use type "%s" for import job.', $fileType));
|
||||
}
|
||||
|
||||
while ($count < 30) {
|
||||
$key = Str::random(12);
|
||||
$existing = $this->findByKey($key);
|
||||
|
@ -17,18 +17,18 @@ Route::group(
|
||||
['middleware' => 'user-not-logged-in'], function () {
|
||||
|
||||
// Authentication Routes...
|
||||
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login'); #
|
||||
Route::post('login', 'Auth\LoginController@login'); #
|
||||
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
|
||||
Route::post('login', 'Auth\LoginController@login');
|
||||
|
||||
// Registration Routes...
|
||||
Route::get('/register', ['uses' => 'Auth\RegisterController@showRegistrationForm', 'as' => 'register']); #
|
||||
Route::post('/register', 'Auth\RegisterController@register'); #
|
||||
Route::get('/register', ['uses' => 'Auth\RegisterController@showRegistrationForm', 'as' => 'register']);
|
||||
Route::post('/register', 'Auth\RegisterController@register');
|
||||
|
||||
// Password Reset Routes...
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm'); #
|
||||
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail'); #
|
||||
Route::post('/password/reset', 'Auth\ResetPasswordController@reset'); #
|
||||
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm'); #
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
|
||||
Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||
Route::post('/password/reset', 'Auth\ResetPasswordController@reset');
|
||||
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user