@@ -56,7 +56,6 @@ |
||
56 | 56 | * @param \Apiary\SmsLoginProvider\SmsHandler\SmsHandlerInterface $handler |
57 | 57 | * @param string|NULL $view |
58 | 58 | * @param string|NULL $message |
59 | - * @param null $debug |
|
60 | 59 | */ |
61 | 60 | public function __construct( |
62 | 61 | SmsHandlerInterface $handler, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ) |
66 | 66 | { |
67 | 67 | $this->messageTemplate = $message ?: 'Security code: %s'; |
68 | - $countryData = file_get_contents(__DIR__ . '/../data/countries.json'); |
|
68 | + $countryData = file_get_contents(__DIR__.'/../data/countries.json'); |
|
69 | 69 | $this->countries = json_decode($countryData); |
70 | 70 | $this->handler = $handler; |
71 | 71 | $this->viewName = $view ?: 'login.twig'; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | return $app['twig']->render($this->viewName, [ |
116 | 116 | 'mobile' => $number, |
117 | - 'form_action' => $app['url_generator']->generate('sms.login') . '/check', |
|
117 | + 'form_action' => $app['url_generator']->generate('sms.login').'/check', |
|
118 | 118 | ]); |
119 | 119 | } |
120 | 120 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the Apiary SMS Login Provider package. |
|
4 | - * |
|
5 | - * (c) Darren Mothersele <[email protected]> |
|
6 | - * |
|
7 | - * For the full copyright and license information, please view the LICENSE |
|
8 | - * file that was distributed with this source code. |
|
9 | - */ |
|
3 | + * This file is part of the Apiary SMS Login Provider package. |
|
4 | + * |
|
5 | + * (c) Darren Mothersele <[email protected]> |
|
6 | + * |
|
7 | + * For the full copyright and license information, please view the LICENSE |
|
8 | + * file that was distributed with this source code. |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace Apiary\SmsLoginProvider\SmsHandler; |
12 | 12 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | public function register(Application $app) |
19 | 19 | { |
20 | - $app['sms.handler'] = $app->share(function () use ($app) { |
|
20 | + $app['sms.handler'] = $app->share(function() use ($app) { |
|
21 | 21 | return new MockSmsHandler($app); |
22 | 22 | }); |
23 | 23 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the Apiary SMS Login Provider package. |
|
4 | - * |
|
5 | - * (c) Darren Mothersele <[email protected]> |
|
6 | - * |
|
7 | - * For the full copyright and license information, please view the LICENSE |
|
8 | - * file that was distributed with this source code. |
|
9 | - */ |
|
3 | + * This file is part of the Apiary SMS Login Provider package. |
|
4 | + * |
|
5 | + * (c) Darren Mothersele <[email protected]> |
|
6 | + * |
|
7 | + * For the full copyright and license information, please view the LICENSE |
|
8 | + * file that was distributed with this source code. |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace Apiary\SmsLoginProvider\SmsHandler; |
12 | 12 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the Apiary SMS Login Provider package. |
|
4 | - * |
|
5 | - * (c) Darren Mothersele <[email protected]> |
|
6 | - * |
|
7 | - * For the full copyright and license information, please view the LICENSE |
|
8 | - * file that was distributed with this source code. |
|
9 | - */ |
|
3 | + * This file is part of the Apiary SMS Login Provider package. |
|
4 | + * |
|
5 | + * (c) Darren Mothersele <[email protected]> |
|
6 | + * |
|
7 | + * For the full copyright and license information, please view the LICENSE |
|
8 | + * file that was distributed with this source code. |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace Apiary\SmsLoginProvider\SmsHandler; |
12 | 12 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | if (!isset($app['sms.handler.from'])) { |
22 | 22 | $app['sms.handler.from'] = 'Apiary'; |
23 | 23 | } |
24 | - $app['sms.handler'] = $app->share(function () use ($app) { |
|
24 | + $app['sms.handler'] = $app->share(function() use ($app) { |
|
25 | 25 | $lookupClient = new \Lookups_Services_Twilio($app['sms.handler.twilio_sid'], |
26 | 26 | $app['sms.handler.twilio_auth_token']); |
27 | 27 | $client = new \Services_Twilio($app['sms.handler.twilio_sid'], |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | $controllers->post('/login', 'login.controller:verifyAction'); |
36 | 36 | |
37 | 37 | // Convert Twilio exception to Auth exception |
38 | - $app->error(function (\Services_Twilio_RestException $e) use ($app) { |
|
39 | - $app['monolog']->addDebug('Converting Twilio Exception: ' . $e->getMessage()); |
|
38 | + $app->error(function(\Services_Twilio_RestException $e) use ($app) { |
|
39 | + $app['monolog']->addDebug('Converting Twilio Exception: '.$e->getMessage()); |
|
40 | 40 | $app['session']->set(Security::AUTHENTICATION_ERROR, |
41 | 41 | new BadCredentialsException('Invalid phone number')); |
42 | 42 | return $app->redirect($app['url_generator']->generate('sms.login')); |
43 | 43 | }); |
44 | 44 | // Store Auth exception and go back to login form |
45 | - $app->error(function (AuthenticationException $e) use ($app) { |
|
45 | + $app->error(function(AuthenticationException $e) use ($app) { |
|
46 | 46 | $app['session']->set(Security::AUTHENTICATION_ERROR, $e); |
47 | 47 | return $app->redirect($app['url_generator']->generate('sms.login')); |
48 | 48 | }); |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | |
54 | 54 | public function register(Application $app) |
55 | 55 | { |
56 | - $app['login.controller'] = $app->share(function () use ($app) { |
|
56 | + $app['login.controller'] = $app->share(function() use ($app) { |
|
57 | 57 | // TODO: Pass in arguments for view template and message template |
58 | 58 | return new SmsLoginController($app['sms.handler'], null, null); |
59 | 59 | }); |
60 | 60 | |
61 | - $app['security.authentication_listener.factory.sms'] = $app->protect(function ( |
|
61 | + $app['security.authentication_listener.factory.sms'] = $app->protect(function( |
|
62 | 62 | $name, |
63 | 63 | $options |
64 | 64 | ) use ($app) { |
65 | 65 | |
66 | - $app['security.entry_point.' . $name . '.sms'] = $app->share(function ( |
|
66 | + $app['security.entry_point.'.$name.'.sms'] = $app->share(function( |
|
67 | 67 | ) use ($app, $options) { |
68 | 68 | $loginPath = $app['url_generator']->generate('sms.login'); |
69 | 69 | $useForward = isset($options['use_forward']) ? $options['use_forward'] : false; |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | $app['security.http_utils'], $loginPath, $useForward); |
72 | 72 | }); |
73 | 73 | |
74 | - $app['security.authentication_provider.' . $name . '.sms'] = $app->share(function ( |
|
74 | + $app['security.authentication_provider.'.$name.'.sms'] = $app->share(function( |
|
75 | 75 | ) use ($app, $name) { |
76 | 76 | return new SmsAuthenticator($name, $app['session']->get('code'), |
77 | 77 | $app['monolog']); |
78 | 78 | }); |
79 | 79 | |
80 | - $app['security.authentication_listener.' . $name . '.sms'] = $app->share(function ( |
|
80 | + $app['security.authentication_listener.'.$name.'.sms'] = $app->share(function( |
|
81 | 81 | ) use ($app, $name, $options) { |
82 | 82 | |
83 | 83 | // Create fake route for login check |
84 | - $loginCheckPath = $app['url_generator']->generate('sms.login') . '/check'; |
|
84 | + $loginCheckPath = $app['url_generator']->generate('sms.login').'/check'; |
|
85 | 85 | $options['check_path'] = $loginCheckPath; |
86 | 86 | $app->match($loginCheckPath)->run(null)->bind(str_replace('/', |
87 | 87 | '_', ltrim($loginCheckPath, '/'))); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $options['username_parameter'] = empty($options['username_parameter']) ? 'mobile' : $options['username_parameter']; |
91 | 91 | $options['password_parameter'] = empty($options['password_parameter']) ? 'code' : $options['password_parameter']; |
92 | 92 | |
93 | - if (!isset($app['security.authentication.success_handler.' . $name])) { |
|
94 | - $app['security.authentication.success_handler.' . $name] = $app->share(function ( |
|
93 | + if (!isset($app['security.authentication.success_handler.'.$name])) { |
|
94 | + $app['security.authentication.success_handler.'.$name] = $app->share(function( |
|
95 | 95 | ) use ($name, $options, $app) { |
96 | 96 | $handler = new DefaultAuthenticationSuccessHandler($app['security.http_utils'], |
97 | 97 | $options); |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | }); |
101 | 101 | } |
102 | 102 | |
103 | - if (!isset($app['security.authentication.failure_handler.' . $name])) { |
|
104 | - $app['security.authentication.failure_handler.' . $name] = $app->share(function ( |
|
103 | + if (!isset($app['security.authentication.failure_handler.'.$name])) { |
|
104 | + $app['security.authentication.failure_handler.'.$name] = $app->share(function( |
|
105 | 105 | ) use ($name, $options, $app) { |
106 | 106 | return new DefaultAuthenticationFailureHandler($app, |
107 | 107 | $app['security.http_utils'], $options, |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | return new UsernamePasswordFormAuthenticationListener( |
113 | 113 | $app['security.token_storage'], |
114 | 114 | $app['security.authentication_manager'], |
115 | - isset($app['security.session_strategy.' . $name]) ? $app['security.session_strategy.' . $name] : $app['security.session_strategy'], |
|
115 | + isset($app['security.session_strategy.'.$name]) ? $app['security.session_strategy.'.$name] : $app['security.session_strategy'], |
|
116 | 116 | $app['security.http_utils'], |
117 | 117 | $name, |
118 | - $app['security.authentication.success_handler.' . $name], |
|
119 | - $app['security.authentication.failure_handler.' . $name], |
|
118 | + $app['security.authentication.success_handler.'.$name], |
|
119 | + $app['security.authentication.failure_handler.'.$name], |
|
120 | 120 | $options, |
121 | 121 | $app['logger'], |
122 | 122 | $app['dispatcher'], |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | return [ |
129 | 129 | // the authentication provider id |
130 | - 'security.authentication_provider.' . $name . '.sms', |
|
130 | + 'security.authentication_provider.'.$name.'.sms', |
|
131 | 131 | // the authentication listener id |
132 | - 'security.authentication_listener.' . $name . '.sms', |
|
132 | + 'security.authentication_listener.'.$name.'.sms', |
|
133 | 133 | // the entry point id |
134 | - 'security.entry_point.' . $name . '.sms', |
|
134 | + 'security.entry_point.'.$name.'.sms', |
|
135 | 135 | // the position of the listener in the stack |
136 | 136 | 'form' |
137 | 137 | ]; |