Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate the secret hash before save rather than after #8410

Merged
merged 1 commit into from Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 23 additions & 16 deletions app/bundles/WebhookBundle/Form/Type/WebhookType.php
Expand Up @@ -34,6 +34,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'strict_html']));

/** @var Webhook $webhook */
$webhook = $builder->getData();

$builder->add(
'name',
TextType::class,
Expand Down Expand Up @@ -78,8 +81,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'class' => 'form-control',
'tooltip' => 'mautic.webhook.secret.tooltip',
],
'empty_data' => EncryptionHelper::generateKey(),
'required' => false,
'data' => $webhook->getSecret() ?? EncryptionHelper::generateKey(),
'required' => false,
]
);

Expand Down Expand Up @@ -126,20 +129,24 @@ public function buildForm(FormBuilderInterface $builder, array $options)

$builder->add('isPublished', YesNoButtonGroupType::class);

$builder->add('eventsOrderbyDir', ChoiceType::class, [
'choices' => [
'mautic.core.form.default' => '',
'mautic.webhook.config.event.orderby.chronological' => Criteria::ASC,
'mautic.webhook.config.event.orderby.reverse.chronological' => Criteria::DESC,
],
'label' => 'mautic.webhook.config.event.orderby',
'attr' => [
'class' => 'form-control',
'tooltip' => 'mautic.webhook.config.event.orderby.tooltip',
],
'placeholder' => '',
'required' => false,
]);
$builder->add(
'eventsOrderbyDir',
ChoiceType::class,
[
'choices' => [
'mautic.core.form.default' => '',
'mautic.webhook.config.event.orderby.chronological' => Criteria::ASC,
'mautic.webhook.config.event.orderby.reverse.chronological' => Criteria::DESC,
],
'label' => 'mautic.webhook.config.event.orderby',
'attr' => [
'class' => 'form-control',
'tooltip' => 'mautic.webhook.config.event.orderby.tooltip',
],
'placeholder' => '',
'required' => false,
]
);
}

public function configureOptions(OptionsResolver $resolver)
Expand Down