Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser!
- #
- # If you don't protect this directory from direct web access, anybody will be able to see your passwords.
- # http://nette.org/security-warning
- #
- common:
- parameters:
- database:
- drive: mysql
- charset: utf8
- hostname: localhost
- username: root
- password: 123456
- database: prerost
- persistent: true
- lazy: true
- php:
- date.timezone: Europe/Prague
- services:
- db:
- class: DibiConnection(%database%)
- authenticator: Authenticator(@db)
- production < common:
- development < common:
- class Authenticator extends Nette\Object implements Nette\Security\IAuthenticator
- {
- private $db;
- public function __construct(DibiConnection $db)
- {
- $this->db = $db
- }
- public function authenticate($credentials)
- {
- list($username, $password) = $credentials;
- $user = $this->db->select('*')->from('users')
- ->where('username = %s', $username)->or('email = %s', $username);
- if (!$user) {
- // ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment