Upgraded to Symfony 2.1-beta2
This commit is contained in:
		@@ -3,18 +3,20 @@
 | 
			
		||||
namespace KekRozsak\SecurityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 | 
			
		||||
use Symfony\Component\Security\Core\SecurityContext;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
use Symfony\Component\Security\Core\User\UserInterface;
 | 
			
		||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
 | 
			
		||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
 | 
			
		||||
use Symfony\Component\Security\Core\SecurityContext;
 | 
			
		||||
use Symfony\Component\Security\Core\User\UserInterface;
 | 
			
		||||
 | 
			
		||||
use KekRozsak\FrontBundle\Entity\User;
 | 
			
		||||
use KekRozsak\FrontBundle\Form\Type\UserType;
 | 
			
		||||
use KekRozsak\SecurityBundle\Entity\User;
 | 
			
		||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
 | 
			
		||||
use KekRozsak\FrontBundle\Entity\UserData;
 | 
			
		||||
 | 
			
		||||
class DefaultController extends Controller
 | 
			
		||||
{
 | 
			
		||||
	/**
 | 
			
		||||
	 * @Route("/login", name="KekRozsakSecurityBundle_login")
 | 
			
		||||
	 * @Template()
 | 
			
		||||
	 */
 | 
			
		||||
	public function loginAction()
 | 
			
		||||
	{
 | 
			
		||||
@@ -31,10 +33,10 @@ class DefaultController extends Controller
 | 
			
		||||
			$session->remove(SecurityContext::AUTHENTICATION_ERROR);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $this->render('KekRozsakSecurityBundle:Default:login.html.twig', array(
 | 
			
		||||
		return array(
 | 
			
		||||
			'last_username' => $session->get(SecurityContext::LAST_USERNAME),
 | 
			
		||||
			'error'         => $error,
 | 
			
		||||
		));
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -48,38 +50,45 @@ class DefaultController extends Controller
 | 
			
		||||
	/**
 | 
			
		||||
	 * @Route("/logout", name="KekRozsakSecurityBundle_logout")
 | 
			
		||||
	 */
 | 
			
		||||
	 public function logoutAction()
 | 
			
		||||
	 {
 | 
			
		||||
	public function logoutAction()
 | 
			
		||||
	{
 | 
			
		||||
		// The security layer will intercept this request. This method will never be called.
 | 
			
		||||
	 }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
 | 
			
		||||
	 * @Template()
 | 
			
		||||
	 */
 | 
			
		||||
	public function registrationAction(Request $request)
 | 
			
		||||
	public function registrationAction()
 | 
			
		||||
	{
 | 
			
		||||
		$user = $this->get('security.context')->getToken()->getUser();
 | 
			
		||||
		if ($user instanceof UserInterface)
 | 
			
		||||
		{
 | 
			
		||||
			return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$user = new User();
 | 
			
		||||
		$form = $this->createForm(new UserType(true), $user);
 | 
			
		||||
		$request = $this->getRequest();
 | 
			
		||||
 | 
			
		||||
		if ($request->getMethod() == 'POST')
 | 
			
		||||
		{
 | 
			
		||||
			$form->bindRequest($request);
 | 
			
		||||
 | 
			
		||||
			if ($form->isValid(array('registration')))
 | 
			
		||||
			{
 | 
			
		||||
				$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
 | 
			
		||||
				$roleRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Role');
 | 
			
		||||
				$regRole = $roleRepo->findOneByName('REGISTERED');
 | 
			
		||||
				$user->addRole($regRole);
 | 
			
		||||
				$user->setRegisteredAt(new \DateTime('now'));
 | 
			
		||||
				$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
 | 
			
		||||
				$em = $this->getDoctrine()->getEntityManager();
 | 
			
		||||
				$em->persist($user);
 | 
			
		||||
				$em->flush();
 | 
			
		||||
 | 
			
		||||
				$userData = new UserData();
 | 
			
		||||
				$user->setUserData($userData);
 | 
			
		||||
				$em->persist($user);
 | 
			
		||||
				$em->persist($userData);
 | 
			
		||||
				$em->flush();
 | 
			
		||||
 | 
			
		||||
				$message = \Swift_Message::newInstance()
 | 
			
		||||
					->setSubject('Új jelentkező')
 | 
			
		||||
					->setFrom('info@blueroses.hu')
 | 
			
		||||
@@ -91,16 +100,18 @@ class DefaultController extends Controller
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $this->render('KekRozsakSecurityBundle:Default:registration.html.twig', array(
 | 
			
		||||
		return array(
 | 
			
		||||
			'form' => $form->createView(),
 | 
			
		||||
		));
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @Route("/most-varj", name="KekRozsakSecurityBundle_reg_success")
 | 
			
		||||
	 * @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success")
 | 
			
		||||
	 * @Template()
 | 
			
		||||
	 */
 | 
			
		||||
	public function registrationSuccessAction()
 | 
			
		||||
	public function regSuccessAction()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array());
 | 
			
		||||
		return array(
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ class KekRozsakSecurityExtension extends Extension
 | 
			
		||||
        $configuration = new Configuration();
 | 
			
		||||
        $config = $this->processConfiguration($configuration, $configs);
 | 
			
		||||
 | 
			
		||||
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
 | 
			
		||||
        $loader->load('services.yml');
 | 
			
		||||
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
 | 
			
		||||
        $loader->load('services.xml');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										318
									
								
								src/KekRozsak/SecurityBundle/Entity/User.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										318
									
								
								src/KekRozsak/SecurityBundle/Entity/User.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,318 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace KekRozsak\SecurityBundle\Entity;
 | 
			
		||||
 | 
			
		||||
use \Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
use \Symfony\Component\Security\Core\User\UserInterface;
 | 
			
		||||
use \Symfony\Component\Security\Core\User\AdvancedUserInterface;
 | 
			
		||||
use \Symfony\Component\Validator\Constraints as Assert;
 | 
			
		||||
use \Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
 | 
			
		||||
 | 
			
		||||
use \KekRozsak\FrontBundle\Entity\UserData;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * KekRozsak\SecurityBundle\Entity\User
 | 
			
		||||
 * @ORM\Entity
 | 
			
		||||
 * @ORM\Table(name="users")
 | 
			
		||||
 * @DoctrineAssert\UniqueEntity(fields="username", message="Ez a felhasználónév már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
 | 
			
		||||
 * @DoctrineAssert\UniqueEntity(fields="email", message="Ez az e-mail cím már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
 | 
			
		||||
 * @DoctrineAssert\UniqueEntity(fields="displayName", message="Ez a név már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
 | 
			
		||||
 */
 | 
			
		||||
class User implements UserInterface, AdvancedUserInterface
 | 
			
		||||
{
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var integer $id
 | 
			
		||||
	 * @ORM\Id
 | 
			
		||||
	 * @ORM\GeneratedValue(strategy="AUTO")
 | 
			
		||||
	 * @ORM\Column(type="integer")
 | 
			
		||||
	 */
 | 
			
		||||
	private $id;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get id
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return integer
 | 
			
		||||
	 */
 | 
			
		||||
	public function getId()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var string $username
 | 
			
		||||
	 * @ORM\Column(type="string", length=50, nullable=false, unique=true)
 | 
			
		||||
	 * @Assert\NotBlank(groups="registration")
 | 
			
		||||
	 */
 | 
			
		||||
	private $username;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set username
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param string $username
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setUsername($username)
 | 
			
		||||
	{
 | 
			
		||||
		$this->username = $username;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get username
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return string
 | 
			
		||||
	 */
 | 
			
		||||
	public function getUsername()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->username;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var string $password
 | 
			
		||||
	 * @ORM\Column(type="string", length=50, nullable=false)
 | 
			
		||||
	 * @Assert\NotBlank(groups="registration")
 | 
			
		||||
	 */
 | 
			
		||||
	private $password;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set password
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param string $password
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setPassword($password)
 | 
			
		||||
	{
 | 
			
		||||
		$this->password = $password;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get password
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return string
 | 
			
		||||
	 */
 | 
			
		||||
	public function getPassword()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->password;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var string $displayName
 | 
			
		||||
	 * @ORM\Column(type="string", length=50, unique=true, name="display_name")
 | 
			
		||||
	 */
 | 
			
		||||
	private $displayName;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set displayName
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param string $displayName
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setDisplayName($displayName)
 | 
			
		||||
	{
 | 
			
		||||
		$this->displayName = $displayName;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get displayName
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return string
 | 
			
		||||
	 */
 | 
			
		||||
	public function getDisplayName()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->displayName;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var string $email
 | 
			
		||||
	 * @ORM\Column(type="string", length=100, nullable=false, unique=true)
 | 
			
		||||
	 */
 | 
			
		||||
	private $email;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set email
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param string $email
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setEmail($email)
 | 
			
		||||
	{
 | 
			
		||||
		$this->email = $email;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get email
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return string
 | 
			
		||||
	 */
 | 
			
		||||
	public function getEmail()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->email;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var DateTime $registeredAt
 | 
			
		||||
	 * @ORM\Column(type="datetime", nullable=false, name="registered_at")
 | 
			
		||||
	 */
 | 
			
		||||
	private $registeredAt;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set registeredAt
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param DateTime $registeredAt
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setRegisteredAt(\DateTime $registeredAt)
 | 
			
		||||
	{
 | 
			
		||||
		$this->registeredAt = $registeredAt;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get registeredAt
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return DateTime
 | 
			
		||||
	 */
 | 
			
		||||
	public function getRegisteredAt()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->registeredAt;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var User acceptedBy
 | 
			
		||||
	 * @ORM\ManyToOne(targetEntity="User")
 | 
			
		||||
	 * @ORM\JoinColumn(name="accepted_by_id")
 | 
			
		||||
	 */
 | 
			
		||||
	private $acceptedBy;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set acceptedBy
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param User $acceptedBy
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setAcceptedBy(User $acceptedBy = null)
 | 
			
		||||
	{
 | 
			
		||||
		$this->acceptedBy = $acceptedBy;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get acceptedBy
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function getAcceptedBy()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->acceptedBy;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var DateTime $lastLoginAt
 | 
			
		||||
	 * @ORM\Column(type="datetime", nullable=true, name="last_login_at")
 | 
			
		||||
	 */
 | 
			
		||||
	private $lastLoginAt;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set lastLoginAt;
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param DateTime $lastLoginAt
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setLastLoginAt(\DateTime $lastLoginAt = null)
 | 
			
		||||
	{
 | 
			
		||||
		$this->lastLoginAt = $lastLoginAt;
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get lastLoginAt
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return DateTime
 | 
			
		||||
	 */
 | 
			
		||||
	public function getLastLoginAt()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->lastLoginAt;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @var \KekRozsak\FrontBundle\Entity\UserData $userData
 | 
			
		||||
	 * @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", mappedBy="user", fetch="LAZY", cascade={"persist"})
 | 
			
		||||
	 * @ORM\JoinColumn(name="id", referencedColumnName="user_id")
 | 
			
		||||
	 */
 | 
			
		||||
	private $userData;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set userData
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param \KekRozsak\FrontBundle\Entity\UserData $userData
 | 
			
		||||
	 * @return User
 | 
			
		||||
	 */
 | 
			
		||||
	public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
 | 
			
		||||
	{
 | 
			
		||||
		$this->userData = $userData;
 | 
			
		||||
		$userData->setUser($this);
 | 
			
		||||
		return $this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get userData
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return \KekRozsak\FrontBundle\Entity\UserData
 | 
			
		||||
	 */
 | 
			
		||||
	public function getUserData()
 | 
			
		||||
	{
 | 
			
		||||
		return $this->userData;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Here comes the remaining part of UserInterface implementation */
 | 
			
		||||
 | 
			
		||||
	public function getRoles()
 | 
			
		||||
	{
 | 
			
		||||
		/* As we use ACLs instead of roles, every user get the
 | 
			
		||||
		 * ROLE_USER role, and nothing else
 | 
			
		||||
		 */
 | 
			
		||||
		return array('ROLE_USER');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getSalt()
 | 
			
		||||
	{
 | 
			
		||||
		/* As we use crypt() to encode passwords, salt is always the
 | 
			
		||||
		 * same as password
 | 
			
		||||
		 */
 | 
			
		||||
		return $this->password;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function eraseCredentials()
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Here comes the AdvancedUserInterface implementation */
 | 
			
		||||
 | 
			
		||||
	public function isAccountNonExpired()
 | 
			
		||||
	{
 | 
			
		||||
		/* Currently, accounts never expire */
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function isAccountNonLocked()
 | 
			
		||||
	{
 | 
			
		||||
		/* Currently, accounts cannot be locked */
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function isCredentialsNonExpired()
 | 
			
		||||
	{
 | 
			
		||||
		/* Currently, credentials never expire */
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function isEnabled()
 | 
			
		||||
	{
 | 
			
		||||
		/* Account is enabled if it is accepted by someone */
 | 
			
		||||
		return ($this->acceptedBy !== null);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										75
									
								
								src/KekRozsak/SecurityBundle/Form/Type/UserType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								src/KekRozsak/SecurityBundle/Form/Type/UserType.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace KekRozsak\SecurityBundle\Form\Type;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
 | 
			
		||||
use KekRozsak\FrontBundle\Form\Type\UserDataType;
 | 
			
		||||
 | 
			
		||||
class UserType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
	protected $_registration;
 | 
			
		||||
 | 
			
		||||
	public function __construct($registration = false)
 | 
			
		||||
	{
 | 
			
		||||
		$this->_registration = $registration;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
	{
 | 
			
		||||
		$builder->add('username', null, array(
 | 
			
		||||
			'label' => 'Felhasználónév',
 | 
			
		||||
			'read_only' => (!$this->_registration),
 | 
			
		||||
			'help'  => 'Ezt fogod használni az oldalra való bejelentkezéshez. Jelszavadhoz hasonlóan kezeld bizalmasan! Jelentkezés után nem lehet megváltoztatni!',
 | 
			
		||||
		));
 | 
			
		||||
		$builder->add('password', 'repeated', array(
 | 
			
		||||
			'type'            => 'password',
 | 
			
		||||
			'second_name'     => 'confirm',
 | 
			
		||||
			'invalid_message' => 'A két jelszó nem egyezik meg!',
 | 
			
		||||
			'required'        => ($this->_registration),
 | 
			
		||||
			'options'         => array(
 | 
			
		||||
						'label' => 'Jelszó',
 | 
			
		||||
						'help'  => 'Ezt fogod használni az oldalra való bejelentkezéshez. Soha ne add meg senkinek!',
 | 
			
		||||
			),
 | 
			
		||||
		));
 | 
			
		||||
		$builder->add('email', null, array(
 | 
			
		||||
			'label' => 'E-mail cím',
 | 
			
		||||
			'help'  => 'Ezen az e-mail címen értesítünk majd, ha felvételt nyersz a körbe.',
 | 
			
		||||
		));
 | 
			
		||||
		$builder->add('displayName', null, array(
 | 
			
		||||
			'label' => 'Név',
 | 
			
		||||
			'help'  => 'Ezen a néven fog szólítani a közösség. Bármikor megváltoztathatod, de az egyértelműség kedvéért ezt mindig jelezd a többiek felé!',
 | 
			
		||||
		));
 | 
			
		||||
		if (!$this->_registration)
 | 
			
		||||
		{
 | 
			
		||||
			$builder->add('userData', new UserDataType(), array(
 | 
			
		||||
				'label' => 'Egyéb adatok',
 | 
			
		||||
			));
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			$builder->add('agree', 'checkbox', array(
 | 
			
		||||
				'property_path' => false,
 | 
			
		||||
				'label'         => ' ',
 | 
			
		||||
				'help'          => 'A Jelentkezés gomb megnyomásával kijelentem, hogy a Kék Rózsa okkultista kör Házirendjét elolvastam, és azt felvételem esetén magamra nézve teljes mértékben elfogadom.',
 | 
			
		||||
			));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getName()
 | 
			
		||||
	{
 | 
			
		||||
		return 'user';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getDefaultOptions()
 | 
			
		||||
	{
 | 
			
		||||
		$opts = array(
 | 
			
		||||
			'data_class' => 'KekRozsak\SecurityBundle\Entity\User',
 | 
			
		||||
		);
 | 
			
		||||
		if ($this->_registration)
 | 
			
		||||
			$opts['validation_groups'] = array('registration');
 | 
			
		||||
 | 
			
		||||
		return $opts;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								src/KekRozsak/SecurityBundle/Resources/config/services.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/KekRozsak/SecurityBundle/Resources/config/services.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
<?xml version="1.0" ?>
 | 
			
		||||
 | 
			
		||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
 | 
			
		||||
	<services>
 | 
			
		||||
		<service id="kek_rozsak_security.encoder.crypt" class="KekRozsak\SecurityBundle\Service\CryptEncoder">
 | 
			
		||||
		</service>
 | 
			
		||||
		<service id="security.authentication.success_handler" class="KekRozsak\SecurityBundle\Security\AuthSuccess">
 | 
			
		||||
			<argument type="service" id="doctrine" />
 | 
			
		||||
		</service>
 | 
			
		||||
	</services>
 | 
			
		||||
</container>
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
parameters:
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
        kek_rozsak_security.encoder.crypt:
 | 
			
		||||
                class: KekRozsak\SecurityBundle\Service\CryptEncoder
 | 
			
		||||
        security.authentication.success_handler:
 | 
			
		||||
                class: KekRozsak\SecurityBundle\Security\AuthSuccess
 | 
			
		||||
                public: false
 | 
			
		||||
                arguments:
 | 
			
		||||
                        doctrine: @doctrine
 | 
			
		||||
@@ -5,6 +5,7 @@
 | 
			
		||||
{% block title %} - Regisztráció {% endblock %}
 | 
			
		||||
{% block content %}
 | 
			
		||||
<h3>Jelentkezés</h3>
 | 
			
		||||
<p>Amennyiben már tagja vagy a körnek, <a href="{{ path('KekRozsakSecurityBundle_login') }}">itt bejelentkezhetsz</a>.
 | 
			
		||||
<p>Az alábbi űrlap kitöltésével jelentkezhetsz a Kék Rózsa okkultista kör tagjai közé. Kérünk, hogy jelentkezés előtt figyelmesen olvasd el a <a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'rolunk' }) }}">Rólunk</a> menüpont szövegét, különös tekintettel a Házirendre.</p>
 | 
			
		||||
<p>A jelentkezés NEM jár automatikus tagsággal. A Házirend szerint a Vének jogot formálhatnak arra, hogy a jelentkezésedet elutasítsák, vagy próbáknak vessenek alá, mielőtt a tagok közé fogadnak.</p>
 | 
			
		||||
	<p><strong>FONTOS!</strong> Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem <a href="http://www.facebook.com/Polesz" target="_blank">Facebookon</a> vagy e-mailben a <a href="jelentkezes@blueroses.hu">jelentkezes@blueroses.hu</a> címen!</p>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user