protected function prepareEditAccountForm(Login $userData)
 {
     if ($this->form instanceof Form) {
         return;
     }
     $rightGroups = array();
     foreach ($this->rightGroupModel->getRightGroups() as $rg) {
         $rightGroups[$rg->getID()] = $rg->getGroupName();
     }
     $this->form = new CmsForm();
     $this->form->setInputData(array_merge($_POST, $_GET));
     $fldName = new InputField('name', 'Name');
     $fldName->setValue($userData->getUsername());
     $fldName->addRule(new RequiredRule($this->translator->_d('backend', 'Please insert a username')));
     $this->form->addField($fldName);
     $fldEmail = new InputField('email', 'E-Mail');
     $fldEmail->setValue($userData->getEmail());
     $fldEmail->setInputFieldRenderer(new EmailInputFieldRenderer());
     $fldEmail->addRule(new RequiredRule($this->translator->_d('backend', 'Please insert an e-mail address')));
     $fldEmail->addRule(new ValidEmailAddressRule($this->translator->_d('backend', 'Please insert a valid e-mail address')));
     $this->form->addField($fldEmail);
     $fldActive = new OptionsField('active', 'Active', array(1 => $this->translator->_d('backend', 'This account is active')));
     $fldActive->setValue($userData->getActive());
     $fldActive->setOptionsFieldRenderer(new CheckboxOptionsFieldRenderer());
     $this->form->addField($fldActive);
     $this->form->addFields(array($fldName, $fldEmail, $fldActive));
 }
Exemplo n.º 2
0
 public function storeLogin(Login $login)
 {
     $stmntSingup = $this->db->prepare("\n\t\t\tINSERT INTO login SET\n\t\t\t\tusername = ?,\n\t\t\t\temail = ?,\n\t\t\t\tpassword = ?,\n\t\t\t\tregisteredby = ?,\n\t\t\t\tsalt = ?,\n\t\t\t\tconfirmed = NULL,\n\t\t\t\tactive = ?,\n\t\t\t\tlastlogin = NULL,\n\t\t\t\twronglogins = 0\n\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\tusername = ?,\n\t\t\t\temail = ?,\n\t\t\t\tactive = ?,\n\t\t\t\tpassword = ?,\n\t\t\t\tsalt = ?\n\t\t");
     $userID = $this->db->insert($stmntSingup, array($login->getUsername(), $login->getEmail(), $login->getPassword(), $login->getRegisteredBy(), $login->getSalt(), (int) $login->getActive(), $login->getUsername(), $login->getEmail(), (int) $login->getActive(), $login->getPassword(), $login->getSalt()));
     return $login->getID() === null ? $userID : $login->getID();
 }