@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Controllers; |
| 4 | 4 | |
| 5 | -use App\Models\User; |
|
| 6 | - |
|
| 7 | 5 | /** |
| 8 | 6 | * HomeController |
| 9 | 7 | * |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public function index($request, $response) |
| 16 | 16 | { |
| 17 | - return $this->view->render($response,'home.twig'); |
|
| 17 | + return $this->view->render($response, 'home.twig'); |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $container = $app->getContainer(); |
| 24 | 24 | |
| 25 | -$container['db'] = function ($container) use ($capsule) { |
|
| 25 | +$container['db'] = function($container) use ($capsule) { |
|
| 26 | 26 | return $capsule; |
| 27 | 27 | }; |
| 28 | 28 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return new \Slim\Flash\Messages; |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | -$container['view'] = function ($container) { |
|
| 37 | +$container['view'] = function($container) { |
|
| 38 | 38 | $view = new \Slim\Views\Twig(__DIR__ . '/../resources/views/', [ |
| 39 | 39 | 'cache' => false, |
| 40 | 40 | ]); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | return $view; |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | -$container['validator'] = function ($container) { |
|
| 57 | +$container['validator'] = function($container) { |
|
| 58 | 58 | return new App\Validation\Validator; |
| 59 | 59 | }; |
| 60 | 60 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $request->getParam('password') |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | - if (! $auth) { |
|
| 35 | + if (!$auth) { |
|
| 36 | 36 | $this->flash->addMessage('error', 'Could not sign you in with those details'); |
| 37 | 37 | return $response->withRedirect($this->router->pathFor('auth.signin')); |
| 38 | 38 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $this->flash->addMessage('info', 'You have been signed up'); |
| 68 | 68 | |
| 69 | - $this->auth->attempt($user->email,$request->getParam('password')); |
|
| 69 | + $this->auth->attempt($user->email, $request->getParam('password')); |
|
| 70 | 70 | |
| 71 | 71 | return $response->withRedirect($this->router->pathFor('home')); |
| 72 | 72 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | $app->get('/', 'HomeController:index')->setName('home'); |
| 7 | 7 | |
| 8 | -$app->group('', function () { |
|
| 8 | +$app->group('', function() { |
|
| 9 | 9 | $this->get('/auth/signup', 'AuthController:getSignUp')->setName('auth.signup'); |
| 10 | 10 | $this->post('/auth/signup', 'AuthController:postSignUp'); |
| 11 | 11 | $this->get('/auth/signin', 'AuthController:getSignIn')->setName('auth.signin'); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | -$app->group('', function () { |
|
| 17 | +$app->group('', function() { |
|
| 18 | 18 | $this->get('/auth/signout', 'AuthController:getSignOut')->setName('auth.signout'); |
| 19 | 19 | $this->get('/auth/password/change', 'PasswordController:getChangePassword')->setName('auth.password.change'); |
| 20 | 20 | $this->post('/auth/password/change', 'PasswordController:postChangePassword'); |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $this->container->view->getEnvironment()->addGlobal('csrf', [ |
| 17 | 17 | 'field' => ' |
| 18 | - <input type="hidden" name="'. $this->container->csrf->getTokenNameKey() .'" |
|
| 19 | - value="'. $this->container->csrf->getTokenName() .'"> |
|
| 20 | - <input type="hidden" name="'. $this->container->csrf->getTokenValueKey() .'" |
|
| 21 | - value="'. $this->container->csrf->getTokenValue() .'"> |
|
| 18 | + <input type="hidden" name="'. $this->container->csrf->getTokenNameKey() . '" |
|
| 19 | + value="'. $this->container->csrf->getTokenName() . '"> |
|
| 20 | + <input type="hidden" name="'. $this->container->csrf->getTokenValueKey() . '" |
|
| 21 | + value="'. $this->container->csrf->getTokenValue() . '"> |
|
| 22 | 22 | ', |
| 23 | 23 | ]); |
| 24 | 24 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __invoke($request, $response, $next) |
| 15 | 15 | { |
| 16 | - if(! $this->container->auth->check()) { |
|
| 16 | + if (!$this->container->auth->check()) { |
|
| 17 | 17 | $this->container->flash->addMessage('error', 'Please sign in before doing that'); |
| 18 | 18 | return $response->withRedirect($this->container->router->pathFor('auth.signin')); |
| 19 | 19 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __invoke($request, $response, $next) |
| 15 | 15 | { |
| 16 | - if($this->container->auth->check()) { |
|
| 16 | + if ($this->container->auth->check()) { |
|
| 17 | 17 | return $response->withRedirect($this->container->router->pathFor('home')); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | class MatchesPasswordException extends ValidationException |
| 14 | 14 | { |
| 15 | 15 | public static $defaultTemplates = [ |
| 16 | - self::MODE_DEFAULT => [ |
|
| 17 | - self::STANDARD => '{{name}} does not macth', |
|
| 18 | - ], |
|
| 19 | - self::MODE_NEGATIVE => [ |
|
| 20 | - self::STANDARD => '{{name}} does not macth negative', |
|
| 21 | - ] |
|
| 22 | - ]; |
|
| 16 | + self::MODE_DEFAULT => [ |
|
| 17 | + self::STANDARD => '{{name}} does not macth', |
|
| 18 | + ], |
|
| 19 | + self::MODE_NEGATIVE => [ |
|
| 20 | + self::STANDARD => '{{name}} does not macth negative', |
|
| 21 | + ] |
|
| 22 | + ]; |
|
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -16,6 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | public function validate($input) |
| 18 | 18 | { |
| 19 | - return User::where('email',$input)->count() === 0; |
|
| 19 | + return User::where('email', $input)->count() === 0; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |