コード例 #1
0
ファイル: Mail.php プロジェクト: schaechinger/feader
 public function sendInvitation($email, Application_Model_Entity_User $user)
 {
     $firstName = $user->getFirstName();
     $lastName = $user->getLastName();
     $link = stripslashes("https://{$this->_domain}/user/signup/code/29da0faeb47f91a8cef1bb2c1b5da19d");
     $message = $this->_translate->_('mail_dear') . ",<br>" . $this->_translate->_('mail_invite_text') . "{$link}<br><br>" . "{$firstName} {$lastName}";
     $subject = $this->_translate->_('mail_invite_subject');
     $this->send($user, $subject, $message, false, $email);
 }
コード例 #2
0
 /**
  * @param Application_Model_Entity_User $user
  * @return string
  */
 public function signUp(Application_Model_Entity_User $user, $notify, $code = null)
 {
     $language = 'en';
     try {
         $locale = new Zend_Locale(Zend_Locale::BROWSER);
         $language = $locale->getLanguage();
         if ($language !== 'de') {
             $language = 'en';
         }
     } catch (Exception $e) {
     }
     $this->_db->insert($this->_table, ['firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'email' => $user->getEmail(), 'password' => $user->getPassword(), 'language' => $language, 'notify' => $notify, 'date' => new Zend_Db_Expr('NOW()'), 'code' => $code]);
     // get the user's id
     $user->setId($this->_db->lastInsertId($this->_table));
     // insert a dataset with the validation code to the validation table
     return Application_Model_ValidationRepository::getInstance()->addValidation($user);
 }
コード例 #3
0
 public function addValidation(Application_Model_Entity_User $user)
 {
     $code = Application_Model_Hash::hash($user->getEmail());
     $this->_db->insert($this->_table, ['code' => $code, 'email' => $user->getEmail()]);
     return $code;
 }
コード例 #4
0
 public function upgradeAction()
 {
     $this->isAllowed('view');
     $request = $this->getRequest();
     $form = new Application_Form_UserUpgrade();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             $valid = true;
             // check passwords
             if ($form->getValue('password') !== $form->getValue('repassword')) {
                 $form->getElement('repassword')->addError('Your passwords don\'t match');
                 $valid = false;
             }
             // check email valid
             if ($form->getValue('email') !== $form->getValue('reemail')) {
                 $form->getElement('reemail')->addError('Your emails don\'t match');
                 $valid = false;
             }
             if ($valid) {
                 $user = new Application_Model_Entity_User();
                 $user->setFirstname($form->getValue('firstname'));
                 $user->setLastname($form->getValue('lastname'));
                 $user->setEmail($form->getValue('email'));
                 $user->setPassword(Application_Model_Hash::hash($form->getValue('password')));
                 $code = $this->_userRepo->signup($user);
                 $this->_mail->sendSignUp($user, $code);
             }
         }
     }
     $this->view->form = $form;
 }
コード例 #5
0
 public function update(Application_Model_Entity_User $user)
 {
     return $this->_db->update($this->_table, ['firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'email' => $user->getEmail(), 'password' => $user->getPassword(), 'role' => $user->getRole()], $this->_db->quoteInto('id=?', $user->getId()));
 }