From 68c4000fe192a62cc95f9620f453bc6a1f5cab51 Mon Sep 17 00:00:00 2001 From: Reinier Kip Date: Wed, 3 Jun 2015 16:42:07 +0200 Subject: [PATCH] Update SendSmsChallengeType, Command to use Country. --- composer.lock | 8 ++++---- .../SelfServiceBundle/Command/SendSmsChallengeCommand.php | 5 +++-- .../SelfServiceBundle/Form/Type/SendSmsChallengeType.php | 5 +++-- .../views/Registration/Sms/sendChallenge.html.twig | 2 +- .../SelfServiceBundle/Service/SmsSecondFactorService.php | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 000fc6aa6..6803f71bb 100644 --- a/composer.lock +++ b/composer.lock @@ -1754,12 +1754,12 @@ "source": { "type": "git", "url": "https://github.com/SURFnet/Stepup-bundle.git", - "reference": "5cce1b8bb5bc74955bdb8901dc93cd1fe41a2280" + "reference": "21801cbe361f246fede06fc9895107ca2b221d0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SURFnet/Stepup-bundle/zipball/5cce1b8bb5bc74955bdb8901dc93cd1fe41a2280", - "reference": "5cce1b8bb5bc74955bdb8901dc93cd1fe41a2280", + "url": "https://api.github.com/repos/SURFnet/Stepup-bundle/zipball/21801cbe361f246fede06fc9895107ca2b221d0d", + "reference": "21801cbe361f246fede06fc9895107ca2b221d0d", "shasum": "" }, "require": { @@ -1798,7 +1798,7 @@ "suaas", "surfnet" ], - "time": "2015-06-03 10:21:18" + "time": "2015-06-03 15:38:36" }, { "name": "surfnet/stepup-middleware-client-bundle", diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Command/SendSmsChallengeCommand.php b/src/Surfnet/StepupSelfService/SelfServiceBundle/Command/SendSmsChallengeCommand.php index 0277f4da9..386272a62 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Command/SendSmsChallengeCommand.php +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Command/SendSmsChallengeCommand.php @@ -18,14 +18,15 @@ namespace Surfnet\StepupSelfService\SelfServiceBundle\Command; +use Surfnet\StepupBundle\Value\PhoneNumber\Country; use Symfony\Component\Validator\Constraints as Assert; class SendSmsChallengeCommand { /** - * @var string + * @var Country */ - public $countryCode; + public $country; /** * @Assert\NotBlank(message="ss.send_sms_challenge_command.recipient.may_not_be_empty") diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Form/Type/SendSmsChallengeType.php b/src/Surfnet/StepupSelfService/SelfServiceBundle/Form/Type/SendSmsChallengeType.php index 0598c5c69..8c2f6541d 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Form/Type/SendSmsChallengeType.php +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Form/Type/SendSmsChallengeType.php @@ -28,12 +28,13 @@ class SendSmsChallengeType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('countryCode', 'choice', [ + ->add('country', 'choice', [ 'label' => /** @Ignore */ 'country code', 'horizontal_label_class' => 'sr-only', 'required' => true, 'choice_list' => CountryCodeListing::asChoiceList(), - 'preferred_choices' => [CountryCodeListing::PREFERRED_CHOICE], + 'preferred_choices' => + ['Surfnet\StepupBundle\Value\PhoneNumber\CountryCodeListing', 'isPreferredChoice'], 'horizontal_input_wrapper_class' => 'foo', ]) ->add('subscriber', 'text', [ diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Resources/views/Registration/Sms/sendChallenge.html.twig b/src/Surfnet/StepupSelfService/SelfServiceBundle/Resources/views/Registration/Sms/sendChallenge.html.twig index a4c0626d0..941691332 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Resources/views/Registration/Sms/sendChallenge.html.twig +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Resources/views/Registration/Sms/sendChallenge.html.twig @@ -28,7 +28,7 @@
{{ form_errors(form) }}
- {{ form_widget(form.countryCode) }} + {{ form_widget(form.country) }}
{{ form_widget(form.subscriber) }} diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Service/SmsSecondFactorService.php b/src/Surfnet/StepupSelfService/SelfServiceBundle/Service/SmsSecondFactorService.php index a85f0c297..ca3442523 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Service/SmsSecondFactorService.php +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Service/SmsSecondFactorService.php @@ -104,7 +104,7 @@ public function clearSmsVerificationState() public function sendChallenge(SendSmsChallengeCommand $command) { $phoneNumber = new InternationalPhoneNumber( - new CountryCode($command->countryCode), + $command->country->getCountryCode(), new PhoneNumber($command->subscriber) );