예제 #1
0
 public function setUp()
 {
     parent::setUp();
     USVN_Translation::initTranslation("en_US", "app/locale");
     $data = array("users_id" => 2, "users_login" => 'testlogin', "users_password" => USVN_Crypt::crypt('testpassword'), "users_is_admin" => false);
     $this->db->insert("usvn_users", $data);
 }
예제 #2
0
파일: CryptTest.php 프로젝트: phpscr/usvn
 public function testCrypt()
 {
     $crypt = USVN_Crypt::crypt("toto");
     $this->assertTrue(USVN_Crypt::checkPassword("toto", $crypt));
     $this->assertFalse(USVN_Crypt::checkPassword("tutu", $crypt));
     $crypt = '$apr1$A.IgA/..$vcK1pKAvkEGvAT0ob46Bw0';
     $this->assertTrue(USVN_Crypt::checkPassword("toto", $crypt));
 }
예제 #3
0
파일: UserTest.php 프로젝트: phpscr/usvn
 public function setUp()
 {
     parent::setUp();
     $this->userTable = new USVN_Db_Table_Users();
     $this->user = $this->userTable->fetchNew();
     $this->user->users_login = '******';
     $this->user->users_password = USVN_Crypt::crypt("test");
     $this->userid = $this->user->save();
     $this->groups = new USVN_Db_Table_Groups();
     $group = $this->groups->insert(array("groups_id" => 42, "groups_name" => "test", "groups_description" => "test"));
     $this->groups->insert(array("groups_id" => 43, "groups_name" => "test2", "groups_description" => "test2"));
     $this->groups->insert(array("groups_id" => 44, "groups_name" => "test3", "groups_description" => "test3"));
 }
예제 #4
0
파일: User.php 프로젝트: jiangti/usvn
 /**
  * Crypt user password if changed
  * Check login if changed
  *
  * @return void
  * @throws USVN_Exception, Zend_Exception
  */
 protected function _update()
 {
     $this->checkEmailAddress($this->_data['users_email']);
     if ($this->_data['users_login'] != $this->_cleanData['users_login']) {
         $user = $this->getTable()->fetchRow(array("users_login = ?" => $this->_data['users_login']));
         if ($user !== null) {
             throw new USVN_Exception(sprintf(T_("Login %s already exist."), $user->login));
         }
         $this->checkLogin($this->_data['users_login']);
     }
     if ($this->_data['users_password'] != $this->_cleanData['users_password']) {
         $this->checkPassword($this->_data['users_password']);
         $this->_data['users_password'] = USVN_Crypt::crypt($this->_data['users_password']);
     }
 }
예제 #5
0
파일: DB.php 프로젝트: phpscr/usvn
 /**
  * Create and save a user
  *
  * @return USVN_Db_Table_Row_User
  */
 protected function createUser($login, $password = "******")
 {
     $table = new USVN_Db_Table_Users();
     try {
         $user = $table->insert(array("users_login" => $login, "users_password" => USVN_Crypt::crypt($password), 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**'));
         $user = $table->find($user)->current();
         return $user;
     } catch (Exception $e) {
         $this->fail($login . " : " . $e->getMessage());
     }
 }