Skip to content

Commit

Permalink
Fix login and user controllers behaviour if firewall is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 25, 2018
1 parent 491e377 commit 0e3e159
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-09-25 DariusIII
* Fix: Fix login and user controllers behaviour if firewall is disabled
* Fix: Fix wrong assingment of role in users table on user creation
* Chg: Remove verified and verification_token from users table, it will be added by verification migration
* Chg: Publish the user verification migration to prevent database user table error
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function edit(Request $request)
$roleName = Role::query()->where('id', $request->input('role'))->value('name');
if ($roleName === 'Disabled') {
$blockedUser = User::find($request->input('id'));
if (\Firewall::isBlacklisted($blockedUser->host) === false) {
if (env('FIREWALL_ENABLED') === true && \Firewall::isBlacklisted($blockedUser->host) === false) {
\Firewall::blacklist($blockedUser->host);
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function login(Request $request)
$user = User::getByEmail($request->input('username'));
}

if ($user !== null && \Firewall::isBlacklisted($user->host) === false) {
if ($user !== null && ((env('FIREWALL_ENABLED') === true && \Firewall::isBlacklisted($user->host) === false) || env('FIREWALL_ENABLED') === false)) {
if (env('NOCAPTCHA_ENABLED') === true && (! empty(env('NOCAPTCHA_SECRET')) && ! empty(env('NOCAPTCHA_SITEKEY')))) {
$this->validate($request, [
'g-recaptcha-response' => 'required|captcha',
Expand Down

0 comments on commit 0e3e159

Please sign in to comment.