コード例 #1
0
 /**
  * Добавляем новую служебную почту для пользователя
  */
 public function testCreateServiceMail()
 {
     // Тру
     $this->assertTrue($this->profile1->createServiceMail($this->user1, '*****@*****.**'));
     // Фэлз
     $this->assertFalse($this->profile1->createServiceMail($this->user2, '*****@*****.**'));
     // Фэлзе
     $this->assertFalse($this->profile1->createServiceMail(new oldUser(), '*****@*****.**'));
     //$this->assertFalse( $this->profile1->createServiceMail( $this->user1, '' ) ); // кхм
 }
コード例 #2
0
 /**
  * Генерируем служебную почту (если она не была сгенерирована)
  */
 function create_service_mail()
 {
     $mail = _Core_Request::getCurrent()->post['mail'];
     $user = Core::getInstance()->user;
     if (Helper_Mail::validateEmail($mail)) {
         if ($this->model->checkServiceEmailIsUnique($mail)) {
             if ($this->model->createServiceMail($user, $mail)) {
                 $this->tpl->assign('result', array('text' => 'Email успешно создан'));
             }
         } else {
             $this->tpl->assign('error', array('text' => "Придумайте другой email.\nЭтот email уже занят"));
         }
     } else {
         $this->tpl->assign('error', array('text' => 'Используйте только английские буквы и цифры'));
     }
 }