Skip to content

Commit

Permalink
Merge pull request #839 from PROCERGS/preview-1.21.2
Browse files Browse the repository at this point in the history
v1.21.2
  • Loading branch information
guilhermednt authored Jan 30, 2019
2 parents a666f45 + 8bf1d8b commit 765cbc2
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "procergs/login-cidadao",
"version": "1.21.0",
"version": "1.21.2",
"license": "AGPL-3.0",
"type": "project",
"description": "login-cidadao",
Expand Down
68 changes: 34 additions & 34 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions src/LoginCidadao/CoreBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace LoginCidadao\CoreBundle\Controller;

use LoginCidadao\APIBundle\Entity\ActionLogRepository;
use LoginCidadao\BadgesControlBundle\Handler\BadgesHandler;
use LoginCidadao\CoreBundle\Form\Type\ContactFormType;
use LoginCidadao\CoreBundle\Model\PersonInterface;
use LoginCidadao\CoreBundle\Model\SupportMessage;
Expand Down Expand Up @@ -44,16 +45,20 @@ public function helpAction()
*/
public function contactAction(Request $request, $correlationId = null)
{
/** @var TranslatorInterface $translator */
$translator = $this->get('translator');

$person = $this->getUser() instanceof PersonInterface ? $this->getUser() : null;

$data = new SupportMessage($person);
$data->setExtra('Correlation Id', $correlationId);

$form = $this->createForm(ContactFormType::class, $data, ['loggedIn' => $person instanceof PersonInterface]);
$form = $this->createForm(ContactFormType::class, $data, [
'loggedIn' => $person instanceof PersonInterface,
'recaptchaError' => $translator->trans('contact.form.captcha.error'),
]);
$form->handleRequest($request);

/** @var TranslatorInterface $translator */
$translator = $this->get('translator');
$message = $translator->trans('contact.form.sent');

if ($form->isValid()) {
Expand All @@ -79,6 +84,7 @@ public function contactAction(Request $request, $correlationId = null)
public function dashboardAction()
{
// badges
/** @var BadgesHandler $badgesHandler */
$badgesHandler = $this->get('badges.handler');
$badges = $badgesHandler->getAvailableBadges();
$userBadges = $badgesHandler->evaluate($this->getUser())->getBadges();
Expand Down
7 changes: 6 additions & 1 deletion src/LoginCidadao/CoreBundle/Form/Type/ContactFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ public function buildForm(FormBuilderInterface $builder, array $options)
]);

if ($this->enableCaptcha) {
$recaptchaConstraint = new Recaptcha2();
$recaptchaConstraint->message = $options['recaptchaError'];
$builder->add('recaptcha', RecaptchaType::class, [
'label' => false,
'mapped' => false,
'constraints' => new Recaptcha2(['groups' => ['LoginCidadaoRegistration', 'Registration']]),
'constraints' => $recaptchaConstraint,
]);
}
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setRequired([
'recaptchaError'
]);
$resolver->setDefaults([
'data_class' => SupportMessage::class,
'loggedIn' => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Authentication Code: Authentication Code
View this notification on Citizen Login: View this notification on Citizen Login
contact.form:
sent: "Your message has been sent. Thank you for contacting us."
captcha.error: "Check the \"I'm not a robot\" box"
extra:
id: "Internal ID"
created_at: "Account Creation Date"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ field.loader : 'Carregando...'
Updated successfully! : 'Atualizado com sucesso'
contact.form:
sent: "Sua mensagem foi enviada. Agradecemos por entrar em contato conosco."
captcha.error: "Marque a opção \"Não sou um robô\""
extra:
id: "Identificador Interno"
created_at: "Data de Criação da Conta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{{ form_row(form.message, { 'attr' : {'class' :'form-control', 'rows': '3' }, 'label_attr' : {'class': 'sr-only'} } ) }}

{% if form.recaptcha is defined %}
{{ form_widget(form.recaptcha) }}
{{ form_row(form.recaptcha) }}
{% endif %}

<button type="submit" class="btn btn-success pull-right">{{ 'contact.form.submit'|trans }}</button>
Expand Down

0 comments on commit 765cbc2

Please sign in to comment.