Skip to content

Commit

Permalink
Fix bug on authenticating non sharp users
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed May 24, 2016
1 parent 70d5392 commit 04aa628
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/Dvlpp/Sharp/Http/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@ public function login(LoginFormRequest $request)

if ($this->auth->attempt($credentials, $request->has('remember'))) {
// Login OK
$this->clearLoginAttempts($request);

return redirect()->intended("admin/cms");
if (!is_sharp_user()) {
// User exists, but he's not a sharp user...
$this->auth->logout();

} else {
// User OK
$this->clearLoginAttempts($request);

return redirect()->intended("admin/cms");
}
}

$this->incrementLoginAttempts($request);
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/sharp_auth_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ function sharp_auth_guard()
function is_sharp_user()
{
$user = sharp_auth_guard()->user();

if (!$user) {
return false;
}

return !method_exists($user, 'isSharpUser')
|| sharp_auth_guard()->user()->isSharpUser();
return !method_exists($user, 'isSharpUser') || $user->isSharpUser();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.17
3.1.18

0 comments on commit 04aa628

Please sign in to comment.