コード例 #1
0
ファイル: NewTForm.php プロジェクト: sasedev/alluco
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('username', 'text', array('label' => 'User.username.label'));
     $builder->add('email', 'email', array('label' => 'User.email.label'));
     $builder->add('lockout', 'choice', array('label' => 'User.lockout.label', 'choices' => User::choiceLockout()));
     $builder->add('preferedLang', 'entity', array('label' => 'User.preferedLang.label', 'class' => 'AllucoDataBundle:Lang', 'query_builder' => function (LangRepository $lr) {
         return $lr->createQueryBuilder('l')->orderBy('l.locale', 'ASC');
     }, 'property' => 'name', 'multiple' => false, 'by_reference' => true, 'required' => false, 'empty_value' => 'Action.choose', 'empty_data' => null));
     //$builder->add('avatar', 'file', array('label' => 'User.avatar.label', 'required' => false));
     $builder->add('sexe', 'choice', array('label' => 'User.sexe.label', 'choices' => User::choiceSexe()));
     $builder->add('firstName', 'text', array('label' => 'User.firstName.label', 'required' => false));
     $builder->add('lastName', 'text', array('label' => 'User.lastName.label', 'required' => false));
     $builder->add('birthday', 'date', array('label' => 'User.birthday.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'required' => false));
     $builder->add('streetNum', 'integer', array('label' => 'User.streetNum.label', 'precision' => 0, 'required' => false));
     $builder->add('address', 'textarea', array('label' => 'User.address.label', 'required' => false));
     $builder->add('address2', 'textarea', array('label' => 'User.address2.label', 'required' => false));
     $builder->add('town', 'text', array('label' => 'User.town.label', 'required' => false));
     $builder->add('zipCode', 'text', array('label' => 'User.zipCode.label', 'required' => false));
     $builder->add('country', 'country', array('label' => 'User.country.label', 'required' => false, 'empty_value' => 'Action.choose', 'empty_data' => null));
     $builder->add('phone', 'text', array('label' => 'User.phone.label', 'required' => false));
     $builder->add('mobile', 'text', array('label' => 'User.mobile.label', 'required' => false));
     $builder->add('userRoles', 'entity', array('label' => 'User.userRoles.label', 'class' => 'AllucoDataBundle:Role', 'query_builder' => function (RoleRepository $rr) {
         return $rr->createQueryBuilder('r')->orderBy('r.name', 'ASC');
     }, 'property' => 'name', 'multiple' => true, 'by_reference' => true, 'required' => true));
 }
コード例 #2
0
ファイル: RegisterTForm.php プロジェクト: sasedev/alluco
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('sexe', 'choice', array('label' => 'profile.sexe.label', 'choices' => User::choiceSexe()));
     $builder->add('firstName', 'text', array('label' => 'profile.firstName.label', 'required' => false));
     $builder->add('lastName', 'text', array('label' => 'profile.lastName.label', 'required' => false));
     $builder->add('username', 'text', array('label' => 'profile.username.label'));
     $builder->add('email', 'email', array('label' => 'profile.email.label'));
     $builder->add('clearPassword', 'password', array('label' => 'profile.password.label'));
     $builder->add('birthday', 'date', array('label' => 'profile.birthday.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'required' => false));
     $builder->add('streetNum', 'integer', array('label' => 'profile.streetNum.label', 'precision' => 0, 'required' => false));
     $builder->add('address', 'textarea', array('label' => 'profile.address.label', 'required' => false));
     $builder->add('address2', 'textarea', array('label' => 'profile.address2.label', 'required' => false));
     $builder->add('town', 'text', array('label' => 'profile.town.label', 'required' => false));
     $builder->add('zipCode', 'text', array('label' => 'profile.zipCode.label', 'required' => false));
     $builder->add('country', 'country', array('label' => 'profile.country.label', 'required' => false, 'empty_value' => 'Options.choose', 'empty_data' => null));
     $builder->add('phone', 'text', array('label' => 'profile.phone.label', 'required' => false));
     $builder->add('mobile', 'text', array('label' => 'profile.mobile.label', 'required' => false));
     $builder->add('fax', 'text', array('label' => 'profile.fax.label', 'required' => false));
     $builder->add('company', 'text', array('label' => 'profile.company.label', 'required' => false));
     $builder->add('fisc', 'text', array('label' => 'profile.fisc.label', 'required' => false));
     $builder->add('userType', 'choice', array('label' => 'profile.userType.label', 'choices' => User::choiceUserType()));
     $builder->add('preferedLang', 'entity', array('label' => 'profile.preferedLang.label', 'class' => 'AllucoDataBundle:Lang', 'query_builder' => function (LangRepository $lr) {
         return $lr->createQueryBuilder('l')->orderBy('l.locale', 'ASC');
     }, 'property' => 'name', 'multiple' => false, 'by_reference' => true, 'required' => false, 'empty_value' => 'options.choose', 'empty_data' => null));
     $builder->add('job', 'entity', array('label' => 'profile.job.label', 'class' => 'AllucoDataBundle:Job', 'query_builder' => function (JobRepository $jr) {
         return $jr->createQueryBuilder('j')->where('j.status = :status')->orderBy('j.rank', 'DESC')->setParameter('status', Job::ST_ENABLED);
     }, 'property' => 'nameTrans', 'multiple' => false, 'by_reference' => true, 'required' => true));
     $builder->add('otherInfos', 'textarea', array('label' => 'profile.otherInfos.label', 'required' => false));
     $builder->add('captcha', 'captcha', array('label' => 'profile.captcha.label', 'width' => 250, 'height' => 60, 'length' => 6, 'quality' => 100, 'as_file' => true));
     $builder->add('submit', 'submit', array('label' => 'action.btnRegister'));
 }
コード例 #3
0
ファイル: UpdateProfileTForm.php プロジェクト: sasedev/alluco
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('sexe', 'choice', array('label' => 'profile.sexe.label', 'choices' => User::choiceSexe()));
     $builder->add('firstName', 'text', array('label' => 'profile.firstName.label', 'required' => false));
     $builder->add('lastName', 'text', array('label' => 'profile.lastName.label', 'required' => false));
     $builder->add('birthday', 'date', array('label' => 'profile.birthday.label', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'required' => false));
     $builder->add('streetNum', 'integer', array('label' => 'profile.streetNum.label', 'precision' => 0, 'required' => false));
     $builder->add('address', 'textarea', array('label' => 'profile.address.label', 'required' => false));
     $builder->add('address2', 'textarea', array('label' => 'profile.address2.label', 'required' => false));
     $builder->add('town', 'text', array('label' => 'profile.town.label', 'required' => false));
     $builder->add('zipCode', 'text', array('label' => 'profile.zipCode.label', 'required' => false));
     $builder->add('country', 'country', array('label' => 'profile.country.label', 'required' => false, 'empty_value' => 'options.choose', 'empty_data' => null));
     $builder->add('phone', 'text', array('label' => 'profile.phone.label', 'required' => false));
     $builder->add('mobile', 'text', array('label' => 'profile.mobile.label', 'required' => false));
 }
コード例 #4
0
ファイル: SecurityController.php プロジェクト: sasedev/alluco
 /**
  * genNewPassword Action
  *
  * @param guid $id
  * @param string $code
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function genNewPasswordAction($id, $code)
 {
     if ($this->hasRole('IS_AUTHENTICATED_FULLY')) {
         return $this->redirect($this->generateUrl('_security_profile'));
     }
     $em = $this->getEntityManager();
     try {
         $user = null;
         $user = $em->getRepository('AllucoDataBundle:User')->find($id);
         if (null != $user) {
             $now = new \DateTime('now');
             if (null == $user->getRecoveryExpiration() || $user->getRecoveryExpiration() < $now) {
                 $this->flashMsgSession('error', $this->translate('_security.genNewPassword.errorparams2'));
             } elseif ($user->getRecoveryCode() != $code) {
                 $this->flashMsgSession('error', $this->translate('_security.genNewPassword.errorparams3'));
             } else {
                 $user->setSalt(md5(uniqid(null, true)));
                 $user->setClearPassword(User::generateRandomChar(8, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'));
                 $user->setRecoveryExpiration(null);
                 $user->setRecoveryCode(null);
                 $em->persist($user);
                 $em->flush();
                 $mvars = array();
                 $mvars['user'] = $user;
                 $from = $this->getParameter('mail_from');
                 $fromName = $this->getParameter('mail_from_name');
                 $subject = $this->translate('_mail.genNewPassword.subject', array(), 'messages');
                 $message = \Swift_Message::newInstance()->setFrom($from, $fromName)->setTo($user->getEmail(), $user->getFullname())->setSubject($subject)->setBody($this->renderView('AllucoSecurityBundle:Mail:genNewPassword.html.twig', $mvars), 'text/html');
                 $this->sendmail($message);
                 $this->flashMsgSession('success', $this->translate('_security.genNewPassword.ok'));
             }
         } else {
             $this->flashMsgSession('error', $this->translate('_security.genNewPassword.errorparams1'));
         }
     } catch (\Exception $e) {
         $logger = $this->getLogger();
         $logger->error($e->getMessage());
         $this->flashMsgSession('error', $this->translate('_security.genNewPassword.errorparams4'));
     }
     return $this->redirect($this->generateUrl('_security_login'));
 }
コード例 #5
0
ファイル: UpdateLockoutTForm.php プロジェクト: sasedev/alluco
 /**
  * Form builder
  *
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('lockout', 'choice', array('label' => 'User.lockout.label', 'choices' => User::choiceLockout()));
 }