Permalink
Browse files

fix bug with disabled login and custom auth

  • Loading branch information...
laurencei committed Jun 11, 2018
1 parent 156316b commit c50bc25dd9cde5ddb4dc64c59900ab431837db3b
Showing with 18 additions and 4 deletions.
  1. +4 −4 app/Http/Controllers/AuthController.php
  2. +14 −0 tests/Controllers/AuthControllerTest.php
@@ -15,14 +15,14 @@ class AuthController extends Controller
*/
public function login(Request $request)
{
if (config('eyewitness.login_disabled', false)) {
return redirect('/');
}
if ($request->session()->has('eyewitness:auth') || Eye::check($request)) {
return redirect(route('eyewitness.dashboard').'#overview');
}
if (config('eyewitness.login_disabled', false)) {
return redirect('/');
}
return view('eyewitness::login');
}
@@ -103,6 +103,20 @@ public function test_closure_auth_succeds()
$response->assertRedirect($this->home.'/dashboard#overview');
}
public function test_closure_auth_succeds_with_login_disabled()
{
$this->app['config']->set('eyewitness.login_disabled', true);
Eye::auth(function ($request) {
return true;
});
$response = $this->get($this->home);
$response->assertSessionMissing('eyewitness:auth');
$response->assertRedirect($this->home.'/dashboard#overview');
}
public function test_closure_auth_fails()
{
Eye::auth(function ($request) {

0 comments on commit c50bc25

Please sign in to comment.