@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function handle($request, Closure $next) |
37 | 37 | { |
38 | 38 | $response = $next($request); |
39 | - if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix').'/run')) { |
|
39 | + if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix') . '/run')) { |
|
40 | 40 | try { |
41 | 41 | $response->getContent(); |
42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | return $response; |
45 | 45 | } |
46 | 46 | |
47 | - if(!$this->webartisan->useAuthentication() |
|
47 | + if (!$this->webartisan->useAuthentication() |
|
48 | 48 | or ($this->webartisan->useAuthentication() |
49 | 49 | and $request->session()->has('webartisan__authenticated'))) { |
50 | 50 |
@@ -39,8 +39,7 @@ |
||
39 | 39 | if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix').'/run')) { |
40 | 40 | try { |
41 | 41 | $response->getContent(); |
42 | - } |
|
43 | - catch (\ErrorException $e) { |
|
42 | + } catch (\ErrorException $e) { |
|
44 | 43 | return $response; |
45 | 44 | } |
46 | 45 |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param null $app |
41 | 41 | */ |
42 | - public function __construct($app = null) |
|
43 | - { |
|
42 | + public function __construct($app = null) |
|
43 | + { |
|
44 | 44 | if (!$app) { |
45 | 45 | $app = app(); //Fallback when $app is not given |
46 | 46 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->enabled = value($this->app['config']->get('webartisan.enabled')); |
50 | 50 | $this->use_authentication = value($this->app['config']->get('webartisan.use_authentication')); |
51 | 51 | $this->authenticated = false; |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Check if the Web Artisan is enabled |
@@ -27,14 +27,14 @@ |
||
27 | 27 | ? $request->get('command') |
28 | 28 | : null; |
29 | 29 | |
30 | - if($this->command) { |
|
30 | + if ($this->command) { |
|
31 | 31 | $commandPrepared = $this->prepareCommand($this->command); |
32 | - if(!config('webartisan.use_authentication') |
|
32 | + if (!config('webartisan.use_authentication') |
|
33 | 33 | or (config('webartisan.use_authentication') and $this->webartisan->isAuthenticated())) { |
34 | 34 | try { |
35 | 35 | Artisan::call($commandPrepared); |
36 | 36 | } |
37 | - catch(\Exception $e) { |
|
37 | + catch (\Exception $e) { |
|
38 | 38 | return $this->prepareResultToHtml($e->getMessage(), 'error'); |
39 | 39 | } |
40 | 40 | } |
@@ -33,12 +33,10 @@ |
||
33 | 33 | or (config('webartisan.use_authentication') and $this->webartisan->isAuthenticated())) { |
34 | 34 | try { |
35 | 35 | Artisan::call($commandPrepared); |
36 | - } |
|
37 | - catch(\Exception $e) { |
|
36 | + } catch(\Exception $e) { |
|
38 | 37 | return $this->prepareResultToHtml($e->getMessage(), 'error'); |
39 | 38 | } |
40 | - } |
|
41 | - else { |
|
39 | + } else { |
|
42 | 40 | return $this->prepareResultToHtml('Please, authenticate yourself before to start using Web Artisan.', 'error'); |
43 | 41 | } |
44 | 42 | return $this->prepareResultToHtml(Artisan::output(), 'success'); |
@@ -38,12 +38,12 @@ |
||
38 | 38 | ? $request->get('password') |
39 | 39 | : null; |
40 | 40 | |
41 | - if($this->username and $this->password) { |
|
41 | + if ($this->username and $this->password) { |
|
42 | 42 | $authenticated = true; |
43 | - if($this->username != config('webartisan.auth.username')) $authenticated = false; |
|
44 | - if($this->password != config('webartisan.auth.password')) $authenticated = false; |
|
43 | + if ($this->username != config('webartisan.auth.username')) $authenticated = false; |
|
44 | + if ($this->password != config('webartisan.auth.password')) $authenticated = false; |
|
45 | 45 | |
46 | - if($authenticated) { |
|
46 | + if ($authenticated) { |
|
47 | 47 | $request->session()->put('webartisan__authenticated', true); |
48 | 48 | return $this->prepareResultToHtml("Welcome", 'success'); |
49 | 49 | } |
@@ -40,14 +40,19 @@ |
||
40 | 40 | |
41 | 41 | if($this->username and $this->password) { |
42 | 42 | $authenticated = true; |
43 | - if($this->username != config('webartisan.auth.username')) $authenticated = false; |
|
44 | - if($this->password != config('webartisan.auth.password')) $authenticated = false; |
|
43 | + if($this->username != config('webartisan.auth.username')) { |
|
44 | + $authenticated = false; |
|
45 | + } |
|
46 | + if($this->password != config('webartisan.auth.password')) { |
|
47 | + $authenticated = false; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | if($authenticated) { |
47 | 51 | $request->session()->put('webartisan__authenticated', true); |
48 | 52 | return $this->prepareResultToHtml("Welcome", 'success'); |
53 | + } else { |
|
54 | + return $this->prepareResultToHtml("Oops, it looks like we don't know each other.", 'error'); |
|
49 | 55 | } |
50 | - else return $this->prepareResultToHtml("Oops, it looks like we don't know each other.", 'error'); |
|
51 | 56 | } |
52 | 57 | return $this->prepareResultToHtml("Username and Password cannot be empty.", 'error'); |
53 | 58 | } |