added "create user" functionality (#37)

* added "create user" functionality #5
* improved user admin views
* added Role constraint and validator
This commit is contained in:
Kevin Papst
2018-01-06 18:33:01 +01:00
committed by GitHub
parent 3270ce7560
commit 56c994c46b
9 changed files with 245 additions and 39 deletions

View File

@@ -0,0 +1,56 @@
<?php
/*
* This file is part of the Kimai package.
*
* (c) Kevin Papst <kevin@kevinpapst.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AppBundle\Form;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Defines the form used to create Users.
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
class UserCreateType extends UserEditType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username', null, [
'label' => 'label.username',
'required' => true
])
->add('plainPassword', RepeatedType::class, [
'required' => true,
'type' => PasswordType::class,
'first_options' => array('label' => 'security.label.password'),
'second_options' => array('label' => 'security.label.password_repeat'),
]);
parent::buildForm($builder, $options);
}
/**
* {@inheritdoc}
*/
public function __configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'class' => 'AppBundle:User',
]);
}
}