Advertisement
Guest User

Untitled

a guest
Oct 17th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.  
  3. use Nette\Security,
  4.     Nette\Utils\Strings;
  5.  
  6. class UsersRepository extends Repository {
  7.    
  8.  
  9.     /**
  10.      * Vráti celý riadok o userovi
  11.      * @return user object
  12.      */
  13.     public function findByName($username) {
  14.         return $this->findAll()->where('username', $username)->fetch();
  15.     }
  16.  
  17.     /**
  18.      * Registrácia nového používateľa
  19.      * @return insert new user into db
  20.      */
  21.     public function register($data) {
  22.         unset($data['password2']);
  23.         $data['role'] = "guest";
  24.         $data['password'] = Authenticator::calculateHash($data['password']);
  25.         return $this->getTable()->insert($data);
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement