mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-30 06:50:49 +00:00 
			
		
		
		
	Code clean up.
This commit is contained in:
		| @@ -18,10 +18,8 @@ | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * ForgotPasswordController.php | ||||
|  * Copyright (c) 2017 thegrumpydictator@gmail.com | ||||
| @@ -53,7 +51,6 @@ class ForgotPasswordController extends Controller | ||||
|  | ||||
|     /** | ||||
|      * Create a new controller instance. | ||||
|      * | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|   | ||||
| @@ -18,10 +18,8 @@ | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * LoginController.php | ||||
|  * Copyright (c) 2017 thegrumpydictator@gmail.com | ||||
| @@ -66,7 +64,6 @@ class LoginController extends Controller | ||||
|  | ||||
|     /** | ||||
|      * Create a new controller instance. | ||||
|      * | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
| @@ -93,7 +90,7 @@ class LoginController extends Controller | ||||
|  | ||||
|         // check for presence of currency: | ||||
|         $currency = TransactionCurrency::where('code', 'EUR')->first(); | ||||
|         if (is_null($currency)) { | ||||
|         if (null === $currency) { | ||||
|             $message | ||||
|                 = 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?'; | ||||
|  | ||||
| @@ -107,7 +104,7 @@ class LoginController extends Controller | ||||
|         $singleUserMode    = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; | ||||
|         $userCount         = User::count(); | ||||
|         $allowRegistration = true; | ||||
|         if ($singleUserMode === true && $userCount > 0) { | ||||
|         if (true === $singleUserMode && $userCount > 0) { | ||||
|             $allowRegistration = false; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -18,10 +18,8 @@ | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * RegisterController.php | ||||
|  * Copyright (c) 2017 thegrumpydictator@gmail.com | ||||
| @@ -66,7 +64,6 @@ class RegisterController extends Controller | ||||
|  | ||||
|     /** | ||||
|      * Create a new controller instance. | ||||
|      * | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
| @@ -77,7 +74,7 @@ class RegisterController extends Controller | ||||
|     /** | ||||
|      * Handle a registration request for the application. | ||||
|      * | ||||
|      * @param  \Illuminate\Http\Request $request | ||||
|      * @param \Illuminate\Http\Request $request | ||||
|      * | ||||
|      * @return \Illuminate\Http\Response | ||||
|      */ | ||||
| @@ -86,7 +83,7 @@ class RegisterController extends Controller | ||||
|         // is allowed to? | ||||
|         $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; | ||||
|         $userCount      = User::count(); | ||||
|         if ($singleUserMode === true && $userCount > 0) { | ||||
|         if (true === $singleUserMode && $userCount > 0) { | ||||
|             $message = 'Registration is currently not available.'; | ||||
|  | ||||
|             return view('error', compact('message')); | ||||
| @@ -119,7 +116,7 @@ class RegisterController extends Controller | ||||
|         // is allowed to? | ||||
|         $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; | ||||
|         $userCount      = User::count(); | ||||
|         if ($singleUserMode === true && $userCount > 0) { | ||||
|         if (true === $singleUserMode && $userCount > 0) { | ||||
|             $message = 'Registration is currently not available.'; | ||||
|  | ||||
|             return view('error', compact('message')); | ||||
| @@ -127,14 +124,13 @@ class RegisterController extends Controller | ||||
|  | ||||
|         $email = $request->old('email'); | ||||
|  | ||||
|  | ||||
|         return view('auth.register', compact('isDemoSite', 'email')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Create a new user instance after a valid registration. | ||||
|      * | ||||
|      * @param  array $data | ||||
|      * @param array $data | ||||
|      * | ||||
|      * @return \FireflyIII\User | ||||
|      */ | ||||
| @@ -151,7 +147,7 @@ class RegisterController extends Controller | ||||
|     /** | ||||
|      * Get a validator for an incoming registration request. | ||||
|      * | ||||
|      * @param  array $data | ||||
|      * @param array $data | ||||
|      * | ||||
|      * @return \Illuminate\Contracts\Validation\Validator | ||||
|      */ | ||||
|   | ||||
| @@ -18,10 +18,8 @@ | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * ResetPasswordController.php | ||||
|  * Copyright (c) 2017 thegrumpydictator@gmail.com | ||||
| @@ -60,7 +58,6 @@ class ResetPasswordController extends Controller | ||||
|  | ||||
|     /** | ||||
|      * Create a new controller instance. | ||||
|      * | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|   | ||||
| @@ -18,7 +18,6 @@ | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace FireflyIII\Http\Controllers\Auth; | ||||
| @@ -32,17 +31,15 @@ use Log; | ||||
| use Preferences; | ||||
|  | ||||
| /** | ||||
|  * Class TwoFactorController | ||||
|  * | ||||
|  * @package FireflyIII\Http\Controllers\Auth | ||||
|  * Class TwoFactorController. | ||||
|  */ | ||||
| class TwoFactorController extends Controller | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * @param Request $request | ||||
|      * | ||||
|      * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View | ||||
|      * | ||||
|      * @throws FireflyException | ||||
|      * | ||||
|      * @SuppressWarnings(PHPMD.CyclomaticComplexity) | ||||
| @@ -53,16 +50,16 @@ class TwoFactorController extends Controller | ||||
|  | ||||
|         // to make sure the validator in the next step gets the secret, we push it in session | ||||
|         $secretPreference = Preferences::get('twoFactorAuthSecret', null); | ||||
|         $secret           = is_null($secretPreference) ? null : $secretPreference->data; | ||||
|         $secret           = null === $secretPreference ? null : $secretPreference->data; | ||||
|         $title            = strval(trans('firefly.two_factor_title')); | ||||
|  | ||||
|         // make sure the user has two factor configured: | ||||
|         $has2FA = Preferences::get('twoFactorAuthEnabled', false)->data; | ||||
|         if (is_null($has2FA) || $has2FA === false) { | ||||
|         if (null === $has2FA || false === $has2FA) { | ||||
|             return redirect(route('index')); | ||||
|         } | ||||
|  | ||||
|         if (strlen(strval($secret)) === 0) { | ||||
|         if (0 === strlen(strval($secret))) { | ||||
|             throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.'); | ||||
|         } | ||||
|         $request->session()->flash('two-factor-secret', $secret); | ||||
| @@ -72,6 +69,7 @@ class TwoFactorController extends Controller | ||||
|  | ||||
|     /** | ||||
|      * @return mixed | ||||
|      * | ||||
|      * @throws FireflyException | ||||
|      */ | ||||
|     public function lostTwoFactor() | ||||
| @@ -95,7 +93,6 @@ class TwoFactorController extends Controller | ||||
|      * | ||||
|      * @return mixed | ||||
|      * @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation. | ||||
|      * | ||||
|      */ | ||||
|     public function postIndex(TokenFormRequest $request, CookieJar $cookieJar) | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user